Regex To Match All Whitespace Except New Line

Category: Strings

A regular expression to match all whitespaces except new links in your content.

Can be useful in replacing a string of text that included 1 or more blank spaces with a new value in only certain places.



  • Any spaces but new lines


  • new lines
  • abc
  • 123

See Also:

Rate This Regex
User Review
0 (0 votes)

Expression Flags

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