WAD Regex Analyzer

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

samintz

Scott Mintz
May 20, 2008
1,232
11
Solon, OH, USA
#1
When I enter this regex: [A-Za-z0-9_]+

The analyzer says Hello World matches. That makes sense because it is matching Hello and ignoring the space and World at the end.

If I change the regex to [A-Za-z0-9_]+$
The analyzer shows green check until I hit the space (Hello<space>) then it shows red X. However, if I continue to type World, it changes back to green check.

Since the space is not part of the allowed characters, why is it succeeding?

-Scott
 

samintz

Scott Mintz
May 20, 2008
1,232
11
Solon, OH, USA
#2
Never mind. User error. Second example was matching the end of the expression and ignoring the beginning.
Changing the regex to ^[A-Za-z0-9_]+$ did the trick.