I've lost count of how many times I've Googled "regex for email validation" at 11pm. So I finally wrote them down. Here are six patterns I use almost weekly — tested, commented, and ready to copy. 1. Extract URLs from text / https ?: \ / \ / [ ^ \ s " '<>]+/gi Enter fullscreen mode Exit fullscreen mode Use this when scraping, cleaning user input, or pulling links out of a Slack dump. The [^\s"'<>]+ stops at whitespace or HTML delimiters instead of eating the rest of the line. 2. Match a valid IPv4 address / \ b (?:(?: 25 [ 0 - 5 ] | 2 [ 0 - 4 ] \ d | [ 01 ]? \ d \ d ?) \ .){ 3 }(?: 25 [ 0 - 5 ] | 2 [ 0 - 4 ] \ d | [ 01 ]? \ d \ d ?) \ b / Enter fullscreen mode Exit fullscreen mode Ugly, yes. But it actually validates the range (0-255) instead of just matching \d+\.\d+\.\d+\.\d+ which would accept 999.999.999.999. Parse config files, extract IPs from logs — this one pays rent. 3.…