in reply to [untitled node, ID 192753]
For the example text you posted, this does work.
#!/usr/bin/perl -w use strict; $line = '<!-- USER 20 - donkey_pusher_6 -->'; print $1 if $line =~ m/\s-{1}\s(\w.+)\s/i;
What it is saying is, look for a single dash surronded by spaces. Then the next alphanumeric characters up until the next space are stored in $1. That's where the parenthesis come in with your match. If you have more than one set of parens, then your matches are stored in $2, $3, etc...
I am going on the assumption here that all your data is in that format. If not, then hopefully that will give you a start in the right direction.
Good luck!
Some people fall from grace. I prefer a running start...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Regex simplification
by Cody Pendant (Prior) on Aug 26, 2002 at 03:22 UTC | |
by Thelonius (Priest) on Aug 26, 2002 at 03:53 UTC |