18

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
  • 15,446
  • 6
  • 63
  • 100

1 Answers1

45

To match everything except whitespace use:

[^\s]+

or

\S+
anubhava
  • 713,503
  • 59
  • 514
  • 593