Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Regular Expression?

Status
Not open for further replies.

Jastper

Programmer
Oct 4, 2002
13
0
0
GB
Hi All, I am new to javascript and am trying to create a regular expression that will only allow numbers, letters and whitespaces (for an address field). Does anyone have any good web references that I could go to or how the expression should look?
Any tips greatefully recieved.
 
try this:
[tt]
function isNumLetOrSpace(s) {
return /^[a-z0-9\s]+$/gi.test(s);
}
[/tt]

usage:[tt]
var myAddress = "123 Main Street";
alert(isNumLetOrSpace(myAddress));
[/tt] =========================================================
while (!succeed) try();
-jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top