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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RegExp any bar space 1

Status
Not open for further replies.

MarkZK

Technical User
Jul 13, 2006
202
GB
Hi, could somebody tell me what the regular expression is to match any length of characters and any character except the space (white space), thanks.
 
/^[^ ]*$/ will match any string (including an empty string) that is made up of any characters other than spaces.

/^[^ ]+$/ will match any string (not including empty strings) that is made up of any characters other than spaces.

/^\S*$/ will match any string made that is made up of any non-white characters (so it will not match newline or line feed or tabs, etc.)

And of course you can change the above regexp to have a + instead of * if you don't want to match empty strings.

-kaht

[small](All puppies have now found loving homes, thanks for all who showed interest)[/small]
 
Bingo, the third one sounds perfect,
Thank you very much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top