🔍

Regex Reference

Regular Expressions are powerful patterns for searching and manipulating text. Essential syntax and code samples for professional development.

Strong Password

/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/

Email (Standard)

/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/

IPv4 Address

/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/

Date (YYYY-MM-DD)

/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/

Strip HTML Tags

/<(\/?[a-z][a-z0-9]*)\b[^>]*>/gi

Match URL

/(https?:\/\/[^\s]+)/g

Positive Lookahead

/abc(?=def)/

Negative Lookahead

/abc(?!def)/

Phone (Universal)

/^(\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}$/

URL Slug

/^[a-z0-9]+(?:-[a-z0-9]+)*$/

Decimal Numbers

/^-?\d*\.?\d+$/

Duplicate Words

/\b(\w+)\s+\1\b/gi