Regular Expression Cheat Sheet

Below is a quick reference guide for regular expressions that I frequently use and find useful.

Online RegEx debugger and library –

# Validate Base64 string.
# Validate Subnet in CIDR notation.
# Validate IP address range.
# Validate IP address.
# Validate an email address.
# Validate an email address (RFC 5322 official definition)
| "(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]
| \\[\x01-\x09\x0b\x0c\x0e-\x7f])*")
@ (?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?
| \[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}
| \\[\x01-\x09\x0b\x0c\x0e-\x7f])+)
# Retrieve index from Win32_LogicalDiskToPartition antecedent.
(?<=Disk #).+(?=\,)
# Retrieve response header containing YouTrack issue number (New-YouTrackItem).

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s