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

anythingBut and a range doesn't work #35

Open
AurelienMendes opened this issue Jan 29, 2019 · 1 comment
Open

anythingBut and a range doesn't work #35

AurelienMendes opened this issue Jan 29, 2019 · 1 comment

Comments

@AurelienMendes
Copy link

Hello,

It seems it's not possible to do something like:

$regex->anythingBut('0-9')

since the sanitize method add systematically a "\" behind the "-" which break the regex range expression.
That giving us:

(?:[^0\-9]*)
instead of
(?:[^0-9]*)

Thanks a lot,
Aurélien

@wangpeipei90
Copy link

I found similar problems with the anythingBut function. If I do anythingBut('test'), it actually turns the regex to be [^test], which not only disallow "test" but also any other words containing t, e, s.
From my point of view, escaping any non-word char with two backslashes is not enough for the function or the value passing into it needs to be restricted.

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

No branches or pull requests

2 participants