19

I now using in Regex this expressions,

([\x20-\x7E]+) - match everything with space

([\x21-\x7E]+) - match everything without space

But i need more performance and in benchmark i see that (.*) is 2x more faster than ([\x20-\x7E]+). Then i replaced that.

But how to write ([\x21-\x7E]+) in (.*) ? Or in other words how to modify (.*) to match everything without whitespace characters?

Thanks!

Svisstack
  • 16,203
  • 6
  • 66
  • 100

2 Answers2

48

To match everything except whitespace use:

[^\s]+

or

\S+
anubhava
  • 761,203
  • 64
  • 569
  • 643
0

I was forced to make the following

"^((?!\s).)*$"

Or if you want it for multiple symbols

"^((?![\s]).)*$"

It will be work in Notepad++ too

Garric
  • 591
  • 3
  • 10