regexr icon indicating copy to clipboard operation
regexr copied to clipboard

Global search 'g' flag doesn't work in Tests

Open aniket-tyagi-ru opened this issue 5 years ago • 1 comments
trafficstars

Adding the global flag for expressions works in 'Text' section but not in 'Tests' section.

image

image

aniket-tyagi-ru avatar Sep 03 '20 14:09 aniket-tyagi-ru

I'm having the same or a similar issue.

@aniket-tyagi-ru I see your Test is a little different from mine though; you have selected "Match Full", which causes the failure in your specific test, I think. (That result may still be a bug, though).

My issue occurs with "Match Any". Technically, the Test passes, but I'd expect it to highlight all instances of the match as it does in Text. Perhaps the exiting behavior is intended since it "Match[es] Any" (the first instance) and then reports the test passing. Maybe the solution for my specific issue would be to have a "Match All" option to highlight/indicate all the match occurrences.

Tests (Does Not Work): Screen Shot 2022-08-19 at 10 45 26 PM

Text (Works): Screen Shot 2022-08-19 at 10 45 15 PM

matthew-ia avatar Aug 20 '22 02:08 matthew-ia

I am facing the same issue. I have created an issue:

https://github.com/gskinner/regexr/issues/513

I hope this get fixed, since I see this problem seems to be existing at least since September 2020.

myverdict avatar Nov 15 '23 18:11 myverdict

This is expected behaviour. The test is to "match any", so as soon as a match is found, the test is successful. It's optimized to not waste additional resources to find further matches because the pass/fail is already determined.

gskinner avatar Nov 15 '23 18:11 gskinner