in reply to sorry, didn't ask the right question about this regex yesterday
Try the following, which uses a zero-width negative lookahead for the "Z":
use warnings; use strict; while (<DATA>){ chomp; print "$_ matches\n" if /ABC(?!Z)/; } __DATA__ ABC ABCD ABCZ ABCZADF ABCDZADF AB XFC 123 AB1 ABC1 XXXABCZ2 ZZZABCDZ2 __END__ ABC matches ABCD matches ABCDZADF matches ABC1 matches ZZZABCDZ2 matches
You didn't state where in a string this can match, so this'll match anywhere.
|
|---|