"be consistent" | |
PerlMonks |
Re^5: problem with optional capture groupby AnomalousMonk (Archbishop) |
on Dec 23, 2020 at 20:54 UTC ( [id://11125694]=note: print w/replies, xml ) | Need Help?? |
... enclosing a regex in 'm()' ...
The What is the trailing xms doing?
I use the /ms modifiers as part of a standard "tail" on all my
qr// m// s/// expressions to give the . ^ $ operators a
(?: (?! </div) .)+ This has already been covered by GrandFather here. This expression just steps forward grabbing one character after another as long as that character is not a part of whatever matches the (?!...) negative lookahead expression, a closing div tag fragment in this case. A bit slow perhaps, but effective and flexible (update: flexible in that the lookahead expression can be of any complexity). See Lookaround Assertions in perlre; see also perlretut, perlreref and perlrequick. (</div)? Optionally capture a literal character sequence if it is present. The capture variable $1 (in this case) will hold the captured sequence if it was present, otherwise $1 will be undefined. See perlre, etc., as above. Give a man a fish: <%-{-{-{-<
In Section
Seekers of Perl Wisdom
|
|