in reply to Re^2: How do I avoid regex engine bumping along inside an atomic pattern?
in thread How do I avoid regex engine bumping along inside an atomic pattern?
But you do need to use \G or else you get your original problem. Using a \G at the start of your RE says, "Does this match right where I left off?" Leaving it out means, "Search from where I left off to find where it matches." So the latter will search ahead and find matches inside comments. The former can have the logic to know whether it is inside a comment or not. The latter does not.
About the second test, I suspect you didn't say exactly what you meant to say in the original question...
|
|---|