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.

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

Replies are listed 'Best First'.
Re^2: Regular Expressions-Finding info between semicolons
by adrianm96 (Novice) on Nov 09, 2016 at 23:44 UTC

    This is exactly what I was looking for! I appreciate it! I'll look into what you wrote to fully understand it.