in reply to Regular Expressions-Finding info between semicolons
Use an inverted character class: [^;]* instead of .*? - then
$_ = ';A-B;C-D;E-F;G-H;J-K;L-M;N-P;R-S;T-W;Y-Z;'; print $1, "\n" if /;([^;]*W[^;]*);/;
yields the desired result.
You don't have to escape the semicolon, since it is no meta-character.
See perlre and "Bracketed Character Classes" in perlrecharclass.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regular Expressions-Finding info between semicolons
by adrianm96 (Novice) on Nov 09, 2016 at 23:44 UTC |