![]() |
|
Just another Perl shrine | |
PerlMonks |
Re: Regexp match start or endby syphilis (Archbishop) |
on Jun 02, 2024 at 13:40 UTC ( [id://11159753]=note: print w/replies, xml ) | Need Help?? |
But is there a way of combining those two regexps into just one? I think (untested): =~ /^perfect|perfect$/i will return true if and only if "perfect"(case-insensitive) appears at either the beginning or the end (or both). !~ /^perfect|perfect$/i will return true if and only if "perfect"(case-insensitive) appears neither at the beginning nor the end. Update: As LanX has noted, beginnings such as "perfection" and endings such as "imperfect" will also be matched. Cheers, Rob
In Section
Seekers of Perl Wisdom
|
|