in reply to Find all strings containing "a" characters, that are not followed by "b" characters.
It looks like you need a look-ahead assersion:
$string = /a(?!b)/;
EDIT: Well, I misread the question (paid too much attention to the title). A simple /a/ and !/a.*b/ (++1008541) or /^[^a]*a+[^b]*$/ should be enough.
Sorry if my advice was wrong.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Find all strings containing "a" characters, that are not followed by "b" characters.
by johngg (Canon) on Dec 12, 2012 at 23:39 UTC | |
Re^2: Find all strings containing "a" characters, that are not followed by "b" characters.
by Not_a_Number (Prior) on Dec 12, 2012 at 18:18 UTC | |
by Kyshtynbai (Sexton) on Dec 12, 2012 at 19:40 UTC | |
by Anonymous Monk on Dec 12, 2012 at 20:09 UTC | |
Re^2: Find all strings containing "a" characters, that are not followed by "b" characters.
by Kyshtynbai (Sexton) on Dec 12, 2012 at 18:12 UTC | |
by Not_a_Number (Prior) on Dec 12, 2012 at 18:22 UTC |
In Section
Seekers of Perl Wisdom