I need a Regular Expression for "Atleast 6 characters with no spaces"
Please help
views:
103answers:
3
+4
A:
- To allow anything other than whitespace
^\S{6,}$
- To allow only alphabets:
^[a-zA-Z]{6,}$
- To allow word chars (alphanumeric and _):
^\w{6,}$
Amarghosh
2010-01-05 10:54:33
A:
You can use \w{6,}
Also FYI:
you can use Regex Coach for Regular Expression experiments. It is easy to play with Regular Expressions by using tools like Regex Coach.
Upul
2010-01-05 10:56:07
A:
For literally any six non-space characters (other than newlines, depending on options):
[^ ]{6,}
For six non-whitespace characters:
\S{6,}
Jesse Millikan
2010-01-05 10:59:08
In both cases it should be {6,} since vaibhav states "at least 6 characters"
Bernhof
2010-01-05 11:02:12