0

What does "\S" equal in Regex?

I have a regex:

/<((?:https?\:\/\/)*(?:[^\/?#])\/*\S*)>/ig;

trying to match:

What does \S equal? e.g.: [\w\d?:"-_]

Nicolas S.Xu
  • 10,813
  • 27
  • 63
  • 112
  • I'd be *very* curious to hear an explanation from whoever nominated this for reopening. I can't imagine what the case for reopening would be. – Adi Inbar Nov 20 '14 at 04:03

2 Answers2

3

\S matches anything except whitespace.

Regard as the opposite of \s (which matches whitespace).

(Personally I find \S obfuscating for this reason, particularly when viewing in some fonts where S and s look too similar. I prefer [^\s]).

Bathsheba
  • 220,365
  • 33
  • 331
  • 451
0

\S means "Non-whitespace characters".

See Wikipedia

Jens
  • 60,806
  • 15
  • 81
  • 95
  • Actually, it means "any one character that's not a whitespace character". The phrase "no whitespaces" is so ambiguous, it's impossible to tell what you meant by it. – Alan Moore Nov 14 '14 at 08:39