sanju
sanju

Reputation:

regular expression for no blank space b/w text

Please tell me how to check regular expression for no blank space b/w text.

Upvotes: 5

Views: 35452

Answers (2)

Zhaph - Ben Duguid
Zhaph - Ben Duguid

Reputation: 26956

If you mean "What's the reqular expression to check there is no white space in a string", the following pattern will work:

^[\S]*$

This will find any string that only contains non-white space (spaces, new lines, tabs, etc).

Upvotes: 28

xsl
xsl

Reputation: 17406

I don't know if it is the regular expression you are looking for but, [:space:] will match any whitespace character, while [:blank:] will match space and tab characters only.

Both are used inside square brackets, e.g. [[:space:]]

Upvotes: 1

Related Questions