Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display number and names of possible groups instead of matched only #2383

Open
kkmuffme opened this issue Nov 10, 2024 · 7 comments
Open

Display number and names of possible groups instead of matched only #2383

kkmuffme opened this issue Nov 10, 2024 · 7 comments

Comments

@kkmuffme
Copy link

Feature

With complex regexes, it's often helpful to be able to see all possible match group numbers and names, even if they are not matched.
e.g. a display like:

Possible named groups: 
foo
bar

Highest group index: 4

for https://regex101.com/r/kzrF6G/1 (this is an extremely simplified example)

@firasdib
Copy link
Owner

Would this not be possible by either hovering the regex, or looking in the explanation? Or do you mean explicitly to understand the numbering?

@kkmuffme
Copy link
Author

Would this not be possible by either hovering the regex

If the regex is extremely complex with lots of groups, atomic groups and non-capturing groups, this is extremely hard and extremely risky to accidentally not get the highest/last group.

looking in the explanation

That's what I did then. I Ctrl+F searched for Capturing Group and Named Capture Group and added these 2 numbers (since Chrome shows you the number of matches) and then subtracted the number of search results found for Non-capturing group
Since this essentially takes multiple steps to do, I think this number should be displayed somewhere.

@firasdib
Copy link
Owner

Okay, so something like a quick summary of the regex somewhere. I guess that could be useful, question is where it should be placed?

@firasdib
Copy link
Owner

This is my current proposal:
billede

@firasdib
Copy link
Owner

Current iteration looks more useful to me:

Screenshot 2024-12-14 at 17 51 59

@kkmuffme
Copy link
Author

Looks great! Possibly at "EXPLANATION" or "MATCH INFORMATION" too, so no extra click/hover is necessary?

(I put it in 2 places just as an example, obviously it would be only in 1)
image

@firasdib
Copy link
Owner

firasdib commented Jan 6, 2025

I'm worried that will turn a bit ambiguous. I will add the hover mechanic shown above in the new version at least.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants