Title |
Test
Find
Alphanumeric
|
Expression |
^[\w ]{0,}$ |
Description |
The alphanumeric patterns I have seen here are unnecessarily long. This is all you need. |
Matches |
abcdefghijklmnopqrstuvwxyz1234567890 |
Non-Matches |
!@#$%^&*()_+=-?><,./:";'[]\{}| |
Author |
Rating:
Stupid Flanders
|
Source |
Stupid Flanders |
Your Rating |
|
Title: Correction and Improvements
Name: Todd
Date: 9/5/2006 10:26:19 AM
Comment:
There are a few problems with this post:
1. You stated that the underscore character ("_") is non-matching, but clearly it DOES match, because it is included the the \w directive. Try putting "hello_there" in the test page and you'll see.
2. Instead of using a space character in the match group, for a generic pattern like this it is better to use the whitespace directive ("\s"), so that things like tabs are matched.
3. Instead of using "{0,}", you should use the asterisk ("*"). It is much easier for someone to read and understand with a single asterisk character, and it probably compiles better across all regex flavors.
The final pattern should be "^[\w\s]*$"
Title: Perfect
Name: Otis Penn
Date: 9/4/2006 3:05:35 PM
Comment:
This regex does what it needs to do- git'r dun!