in reply to Determing if this regex matched
I thought I could check $&, but it's zero length every time through the loop. I don't understand why that is, because it's supposed to give the last successful pattern match, and there are successful matches in every case except the second.The g modifier seems to be clearing $& (or maybe it never gets set in the first place). Add re to your code and you should see the match be successful at first, but it ultimately fails:
In any case, the g modifier is probably doing you more harm than good. Perhaps a more knowledgeable monk can elaborate on what's going on here. Further reading:use re 'debug';
|
|---|