Regular Expression To Match Whitespace

Category: Strings

A regular expression to match the first whitespace found in a term or sentence (exclude newlines).

/[^\S\r\n]/

Matches:

  • Regex [WHITESPACE] Pattern
  • Regex [WHITESPACE] Pattern [SECOND WHITESPACE] COM

Non-matches:

  • All other whitespaces except the first one.

See Also:

Rate This Regex
Sending
User Review
0 (0 votes)

Expression Flags

Flags Description
i Ignore case sensitive.
g Allows global search.
m Allows multiline search.