SimpleRegex / SRL-PHP

Simple Regex Language
https://simple-regex.com
MIT License
1.8k stars 112 forks source link

Negated character classes #26

Closed mandarg closed 8 years ago

mandarg commented 8 years ago

Is there a way to represent negated character classes? e.g. [a-z]{2}[^0-9]? Neither of these seem to work:

letter exactly 2 times,
not digit
letter exactly 2 times,
no digit

...incidentally, both of these generate the regular expression [a-z]{2}[0-9] – I'm not sure if this is a bug, or just an expected consequence of an unrecognized keyword.

KarimGeiger commented 8 years ago

Thanks for the report. No, there currently is no way of negating characters. This is definitely a missing feature which will hopefully be addressed shortly.

Additionally, there should be no regular expression generated when supplying unrecognized keywords but an exception raised. Since this is not happening here, it looks like a bug.

KarimGeiger commented 8 years ago

Thanks to @BartoszKolanko for fixing this issue.