简体   繁体   中英

regular expression for no blank space b/w text

请告诉我如何检查正则表达式没有空格黑白文本。

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).

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, eg [[:space:]]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM