Regex Tester
Test and validate your regular expressions in real-time. Supports JavaScript RegExp syntax and flags.
/
/gi
Match Information
0 matchesNo matches found
Cheatsheet
.Any character except newline\dDigit (0-9)\wWord char (a-z, A-Z, 0-9, _)\sWhitespace[abc]Any of a, b, or c^Start of string$End of string
Quantifiers
*0 or more+1 or more?0 or 1{3}Exactly 3{3,}3 or more{3,6}Between 3 and 6
Flags
- g - Global search
- i - Case-insensitive
- m - Multiline
- s - Allows . to match newline
Common Regex Library
Explore our collection of commonly used regular expressions for various use cases.
Email and Contact
URLs and Domains
Numbers and Formatting
- Positive integersMatches only positive whole numbers.
- Integers (positive/negative)Matches positive or negative whole numbers.
- Decimal numbersMatches positive or negative decimal numbers.
- Numbers with commasMatches numbers formatted with thousand-separator commas.
- Currency (two decimals)Matches currency amounts with up to two decimal places.
- HexadecimalMatches hexadecimal numbers starting with '0x'.
- BinaryMatches binary strings (0s and 1s).
- OctalMatches octal numbers (0-7).
- PercentageMatches percentage values.
- Scientific notationMatches numbers in scientific E-notation.
Dates and Time
Passwords and Security
- Strong password (basic)Requires lowercase, uppercase, and a digit. Min 8 characters.
- Strong password (special chars)Requires lowercase, uppercase, digit, and special character. Min 8 chars.
- Alphanumeric passwordAllows only letters and numbers, minimum 6 characters.
- Password length checkSimply checks for a length between 8 and 20 characters.
- Password complexityComprehensive complexity check.
Text Patterns
- Letters onlyMatches strings containing only letters.
- Letters and spacesAllows letters and whitespace characters.
- AlphanumericMatches only letters and numbers.
- Empty or whitespace onlyMatches empty strings or those containing only spaces/tabs.
- Any whitespaceFinds any occurrences of whitespace.
- No whitespaceMatches strings with no whitespace characters at all.
- Starts with capital letterChecks if the first character is uppercase.
- Ends with lowercase letterChecks if the last character is lowercase.
- Whole wordsMatches individual words.
- Length between 3-16 charactersMatches any string with length 3 to 16.
HTML and XML
- HTML tagsMatches standard HTML tags and their content.
- HTML commentsMatches HTML comments.
- Script tagsMatches script blocks.
- Style tagsMatches style blocks.
- Any HTML tagFinds any HTML tag in a string.
- HTML entitiesMatches named HTML entities like &.
- Numeric HTML entitiesMatches numeric HTML entities like {.
- Image source extractionExtracts the 'src' attribute from image tags.
- Link extractionExtracts 'href' attributes from links.
- Anchor textExtracts the text content inside anchor tags.
Code Patterns
- Single-line comments (C-style)Matches // comments until the end of the line.
- Multi-line comments (C-style)Matches /* ... */ blocks across multiple lines.
- Python/bash commentsMatches # comments until the end of the line.
- Double-quoted stringsMatches strings inside double quotes, handling escaped characters.
- Single-quoted stringsMatches strings inside single quotes, handling escaped characters.
- JavaScript keywordsMatches basic JavaScript variable and function keywords.
- Python keywordsMatches common Python code keywords.
- PHP variablesMatches standard PHP variable syntax.
- Decorators/annotationsMatches @ symbols followed by words (common in Python, Java, etc.).
- Curly brace blocksMatches text inside curly braces.
File Paths and Names
- Filename with extensionSimple filename and extension validation.
- Image file extensionsChecks for common image file endings.
- Document file extensionsChecks for common document file endings.
- Windows drive pathMatches the start of a Windows file path.
- Unix pathValidates an absolute Unix-style file path.
- JavaScript filesMatches .js extension at the end.
- Stylesheet filesMatches common CSS and pre-processor extensions.
- Valid filename (Windows)Matches names that don't use reserved Windows characters.
- Media filesMatches common audio and video formats.
- Git files/foldersFinds references to .git folders or files.
User Input Validation
- Name (letters only)Matches a simple first or last name.
- Full nameMatches a full name with spaces, hyphens, and apostrophes.
- Country/state codeMatches 2 or 3 letter uppercase codes (ISO).
- US ZIP codeMatches 5-digit ZIP or ZIP+4 formats.
- Canadian postal codeMatches Canadian postal code format.
- Twitter handleMatches @ followed by a username.
- UsernameCommon username validation.
- Hex color codeMatches 6-character hex color codes.
- RGB colorMatches rgb(r, g, b) format.
- ISBN-13Matches a 13-digit ISBN number.
Credit Cards and Financial
- Credit card (with dashes)Matches credit cards formatted with dashes.
- Credit card (no spaces)Matches a continuous 16-digit credit card number.
- Visa cardValidates starting '4' and standard length for Visa.
- MastercardValidates MasterCard starting digits and length.
- American ExpressValidates Amex starting digits and length.
- Price/money formatMatches currency with optional dollar sign and mandatory 2 decimal places if dot is used.
- Decimal money (strict)Strictly matches digits followed by two decimals.
- Currency code (ISO)Matches 3-letter currency codes like USD, EUR.
Special Use Cases
- Contains upper and lowercaseValidates if a string has at least one upper and one lowercase letter.
- Contains digitEnsures there is at least one digit in the string.
- Contains special characterEnsures there is at least one special character.
- No spaces (lookahead)Negative lookahead to ensure no spaces anywhere.
- AcronymsMatches groups of 2 or more uppercase letters.
- IP address (simple)Finds sequences that look like IP addresses.
- MD5 hashValidates the length and content of an MD5 hash.
- SHA-1 hashValidates the length and content of an SHA-1 hash.
- Formatted numbers with decimalsMatches numbers with optional commas and optional decimal points.
- Binary byteMatches exactly 8 binary digits.
- 4-digit PINMatches a simple 4-digit PIN code.
- License plate (variable)Matches common license plate length/character sets.