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
  • 13,794
  • 31
  • 84
  • 129
  • 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
  • 231,907
  • 34
  • 361
  • 483
0

\S means "Non-whitespace characters".

See Wikipedia

Jens
  • 67,715
  • 15
  • 98
  • 113
  • 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