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

Report nested character classes as invalid #210

Open
apismensky opened this issue Dec 15, 2023 · 0 comments
Open

Report nested character classes as invalid #210

apismensky opened this issue Dec 15, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@apismensky
Copy link

Hyperscan should report the following cases as invalid (or unsupported) (from https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html)

[a-d[m-p]]      a through d, or m through p: [a-dm-p] (union)
[a-z&&[def]]    d, e, or f (intersection)
[a-z&&[^bc]]    a through z, except for b and c: [ad-z] (subtraction)
[a-z&&[^m-p]]   a through z, and not m through p: [a-lq-z](subtraction)

Right now validation succeeds but the scan returns false negatives for the following scenarios (PREFILTER flag is ON):

String regex="[a-d[m-p]]";
String input = "a";

String regex = "[a-z&&[def]]";
String input = "d";

String regex = "[a-z&&[^bc]]";
String input = "a";

String regex = "[a-z&&[^m-p]]";
String input = "a";

They all match in java8 and rust, according to https://regex101.com/

@markos markos added the bug Something isn't working label Dec 15, 2023
@markos markos self-assigned this Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants