firasdib / Regex101

This repository is currently only used for issue tracking for www.regex101.com
3.26k stars 199 forks source link

No explanation for some literals #704

Closed ghost closed 7 years ago

ghost commented 7 years ago

Hello I noticed that if you use regexp ^[a-z-0-9]+$ to match against "a-2-3" this gives a match, but the reasons on the right sidebox do not accurately explain the match. (nothing explains why the hyphens match )

The unescaped "-" that sits in the middle seems to be taken into account as a litteral, this is correct altough some sources say it could also have been considered an error.

Using the regexp ^[a-z\-0-9]+$ also matches, and gives the proper explanation on the right

I believe the "fix" would be to explain this is taken "into account as a literal BUT could be taken as an error" .

Just FYI,

Ouims commented 7 years ago

Hello, both expressions you gave are the same, but i suppose the second one is meant to be without the middle '-'. This is indeed a bug, the explanation on the right should see that '-' and explain it. If it is seen as an error by the engine in use, the explanation should reflect that, the fix is different per engine.

firasdib commented 7 years ago

thanks for the report, fixed.