The following are regular expression examples which will match:
- An entire line.
^.*$
- Blank lines.
^$
- Whitespace on a line.
\s+
- Whitespace across lines.
(?n\s+)
- Whitespace that spans at least two lines. Note minimal matching
*?
quantifier.
(?n\s*?\n\s*)
- IP address (not robust).
(?:\d{1,3}(?:\.\d{1,3}){3})
- Two character US Postal state abbreviations (includes territories).
[ACDF-IK-PR-W][A-Z]
- Web addresses.
(?:https?://)?www\.\S+
- Case insensitive double words across line breaks.
(?i(?n<(\S+)\s+\1>))
- Upper case words with possible punctuation.
<[A-Z][^a-z\s]*>