Forum Moderators: open

Message Too Old, No Replies

Javascript Regex

need help with Javascript Regex

         

MrFahad

6:12 pm on Feb 10, 2009 (gmt 0)

10+ Year Member



Hello, does anyone know what is the regex for numbers and alphabetic
only and allow to leave space between words and how to write it for javascript ?

thank you

[edited by: MrFahad at 6:18 pm (utc) on Feb. 10, 2009]

coopster

1:42 am on Feb 11, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Numbers can be defined in either a character class
[0-9]
or by the special digit character
\d

Alphabet characters in a character class

[a-zA-Z]
or you can use the case-insensitive format
/[a-z]/i

Space characters can either be the literal space or you can use the special space character

\s

If you are concerned about words, you may want to consider the special word boundary

\b
character.

MrFahad

2:14 am on Feb 11, 2009 (gmt 0)

10+ Year Member



it worked thanks for help :)