开发者

regex to disallow whitespace

开发者 https://www.devze.com 2023-02-15 11:46 出处:网络
I\'m looking for a regex that will allow Alpha Numeric and most all special characters except white space. It should be usable in c#. It would be nice if .net supported posix style but I can\'t seem t

I'm looking for a regex that will allow Alpha Numeric and most all special characters except white space. It should be usable in c#. It would be nice if .net supported posix style but I can't seem to get it to work. T开发者_StackOverflowIA


Pretty sure \S (note capitalization) is the non-whitespace character class.


Something along the lines of: [^\s]+ should do the trick.

This roughly translates as "match one or more consecutive characters that are not whitespace" (\s matches a space, tab, or line break).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号