Regex for blank lines
/^\s*$\n/gm
Matches
Examples
Note
Replace with nothing to delete empty and whitespace-only lines.
Matches in the example
"\n \n""\n"
Token by token
^the start of the string (or line, with the m flag)\s*a whitespace character, zero or more times, as many as possible$the end of the string (or line, with the m flag)\na line feed
Other patterns
- Email address
- URL
- IPv4 address
- UUID
- Hex color
- Date (YYYY-MM-DD)
- Time (24-hour)
- US phone number
- Phone number (E.164)
- US ZIP code
- Credit card number
- URL slug
- Username
- Strong password
- HTML tag
- Semantic version
- MAC address
- JSON Web Token
- Hashtag
- @mention
- Number
- Leading and trailing whitespace
- Repeated word
- Blank lines
- Markdown link
- Quoted string
- Domain name
- File extension
- Base64
- Trailing comma