Regex To Match Any Word In A String Excluding Spaces

Category: Strings

A regular expression to match any word in a string until meeting spaces.

/([^\s]+)/

Matches:

  • This Is Word

Non-matches:

  • Any spaces found in a string

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.