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

RegExp flags are removed #183

Closed
xblanc33 opened this issue Jan 16, 2022 · 3 comments
Closed

RegExp flags are removed #183

xblanc33 opened this issue Jan 16, 2022 · 3 comments
Assignees
Labels

Comments

@xblanc33
Copy link

convertMatchListToRegExp() removes all flags as it uses the RegExp.source property (see utilities-data.ts line 47)

Not so easy to define what should be the correct behavior but I would advocate that the 'i' flag is very useful ;)
BTW the 'g' flag is not useful as css-selector-generator only tests the RegExp..

Why not setting a 'i' flag if at least one of the RegExp of the list defines it ?

I can make the PR if your want to.

Regards

@fczbkk fczbkk self-assigned this Jan 16, 2022
@fczbkk fczbkk added the bug label Jan 16, 2022
fczbkk added a commit that referenced this issue Jan 16, 2022
@fczbkk
Copy link
Owner

fczbkk commented Jan 16, 2022

Hey @xblanc33, thanks for the report. The RegExp patterns should be fixed now so that they will respect provided flags. Please update to v3.5.4.

@fczbkk fczbkk closed this as completed Jan 16, 2022
@xblanc33
Copy link
Author

Great using some is what I was thinking of.
Is it faster than creating one main big RegExp expression ?

@fczbkk
Copy link
Owner

fczbkk commented Jan 17, 2022

Is it faster than creating one main big RegExp expression ?

It is not possible to create a single RegExp that will use different flags for parts of the expression. So that's not even an option. Anyway, I don't think it really matters in this case, as the volume of checked items is quite small. So the performance in common situations should be practically the same (almost zero).

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

No branches or pull requests

2 participants