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

pattern not parsed and reports error #5

Closed
jakubmisek opened this issue Feb 2, 2021 · 2 comments
Closed

pattern not parsed and reports error #5

jakubmisek opened this issue Feb 2, 2021 · 2 comments
Assignees

Comments

@jakubmisek
Copy link
Member

the following pattern is correct, although it throws A subtraction must be the last element in a character class.

/^[ !#-[\]-~]*\z/

Example:

var_dump(preg_match('/^[ !#-[\]-~]*\z/', $subject));
@roberthusak
Copy link
Contributor

I fixed it for certain cases, such as the one provided. However, to become fully compatible in this manner with PCRE, we'd need to remove character class subtraction, because it's allowed in .NET but not in PCRE. E.g. [a-z-[aeiuo]] has different meaning in each of them - while in .NET it matches b, in PCRE it matches -].

@jakubmisek
Copy link
Member Author

thank you Robert!

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