to elaborate further here the proof that it's matching, just at the wrong position
DB<1> $foo = 'a=b'; DB<2> $foo = 'x' . $foo DB<3> p scalar $foo =~/(?:a=([a-z]+))?/; 1 DB<4> p $1 DB<5> DB<6> p scalar $foo =~/(?:a=([a-z]+))?/g; 1 DB<7> p pos $foo 0 DB<8>
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
In reply to Re^2: Making a subpattern optional with ? causes subpattern match to fail. I am confused as to why.
by LanX
in thread Making a subpattern optional with ? causes subpattern match to fail. I am confused as to why.
by msouth
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |