Jump to content

regular expression for space bar?


feck

Recommended Posts

Is there a regular expression just for the space bar?I know of \t for tab \n for line feed but what is there just for the space bar.Basically i would like to be able to stop users inputting too much space so have been using /[\s{2}]/ to check for the existence of more than 1 white-space character.But this also includes \r for returns, and do not want to include this as some input such as an address inputcan have return characters.Any help would be welcomed

Link to comment
Share on other sites

What is it about this goddamed site, that nearly always provides a solution to my answer before anyone has even responded.I always delay asking a question until i feel i have used up all other avenues of information, and then 8 times out of 10 i ask a question and the answer immediatly becomes clear to me after i've finished the post.Changed my reg ex to /[\t{2}]/ and now checks for tabs and spaces, but not returns, so now text boxes can be checked for too much whitespace with no fear of users entering returns, and textareas can include returns.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...