MajingaZ has asked for the wisdom of the Perl Monks concerning the following question:
The regular expression is setting the second match to newline instead of pipe as it should.$foo = qq{^snafu^|^foobar^\n}; $foo =~ m/\A(\W) # \A instead of ^ and match first non-word [^\1]+ # Match everything that isn't in \1 \1(\W) # Match non-word following the 2nd \1 /xms; $text_qual = $1; $field_sep = $2;
But this only works for this limited case where the first field contains no symbols. Any suggestions would be greatly appreciated.$foo =~ m/\A(\W) # \A instead of ^ and match first non-word \w+\1 # Match any word char until the next \1 (\W) # Match following non-word /xms;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regular Expresssion TroubleShoot Help plz
by hv (Prior) on Mar 29, 2006 at 02:20 UTC | |
by MajingaZ (Beadle) on Apr 12, 2006 at 01:30 UTC | |
|
Re: Regular Expresssion TroubleShoot Help plz
by Crackers2 (Parson) on Mar 29, 2006 at 00:42 UTC | |
|
Re: Regular Expresssion TroubleShoot Help plz
by SamCG (Hermit) on Mar 29, 2006 at 00:38 UTC |