Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: Problem with regex wildcard operator (.)...?by BillKSmith (Monsignor) |
on Sep 06, 2021 at 03:37 UTC ( [id://11136490]=note: print w/replies, xml ) | Need Help?? |
Your misunderstanding has nothing to do with the metacharacter '.', but rather with the quantifier '?'. When a character (or metacharacter) in your regex matches zero times, you will reach the end of the regex before you have matched all the characters in the string. Your 'end-of-string' anchor '$' fails.
Bill
In Section
Seekers of Perl Wisdom
|
|