Regex To Match Non-blank And Non-Empty String

Category: Strings

A regular expression to match non-blank and non-empty strings. Can be used to extract all content without blank lines and empty strings from the document.

/(.|\s)*\S(.|\s)*/

Matches:

  • ABC
  • A B C
  • A+B

Non-matches:

  • Any blank lines and empty strings

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.