Regex Library
Neural Regex Library
CENTRAL PATTERN DATABASE v4.0
| CATEGORY | PATTERN | DEFINITION |
|---|---|---|
| BASIC | \d |
Matches any digit (0-9). |
| SECURITY | (?=.*[A-Z])(?=.*[0-9]).{8,} |
Strong Password: 8+ chars, 1 Upper, 1 Num. |
| ID | ^[0-9]{9}[vV]$ |
Old Sri Lankan NIC (9 digits + V/X). |
| NETWORK | (https?:\/\/)?([\da-z\.-]+) |
Complete URL/Link matching. |
| COMMUNICATION | [a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,} |
Standard Email matching pattern. |
| SOCIAL | @([A-Za-z0-9_]+) |
Twitter/Instagram style @mentions. |
| SOCIAL | #([A-Za-z0-9_]+) |
Hashtag extraction (e.g., #Oatcalo). |
| FINANCE | \$\d+(\.\d{2})? |
Currency matcher (Matches $10 or $10.99). |
| BITCOIN | ^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$ |
BTC Wallet address validation. |
| CREDIT CARD | ^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14})$ |
Visa & Mastercard card number detection. |
| NETWORK | \b\d{1,3}(\.\d{1,3}){3}\b |
IPv4 Address matching (e.g., 192.168.1.1). |
| HARDWARE | ^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$ |
MAC Address validation (Physical ID). |
| ID | ^[0-9]{12}$ |
New Sri Lankan NIC (12 digits). |
| DATABASE | [0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12} |
UUID/GUID matching (Unique System IDs). |
| VERSION | v?\d+\.\d+\.\d+ |
Semantic Versioning (e.g., v4.0.1). |
| DATES | \d{4}-\d{2}-\d{2} |
ISO Date format (YYYY-MM-DD). |
| TIME | ^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$ |
24-hour format time (HH:MM). |
| TIME | (1[012]|[1-9]):[0-5][0-9](\s)?(?i)(am|pm) |
12-hour format with AM/PM. |
| WEB DEV | #([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}) |
HEX Color Codes (e.g., #22D3EE). |
| WEB DEV | rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\) |
RGB Color extractor. |
| WEB DEV | <img\s+[^>]*src="([^"]*)"[^>]*> |
Extract Image Sources (SRCs) from HTML. |
| WEB DEV | <a\s+(?:[^>]*?\s+)?href="([^"]*)" |
Extract all Hyperlinks from a page. |
| FILES | ^.*\.(jpg|jpeg|png|gif)$ |
Detect Image file extensions. |
| FILES | ^.*\.(pdf|docx|txt)$ |
Detect Document file extensions. |
| CODE JS | (var|let|const)\s+([a-zA-Z_$][0-9a-zA-Z_$]*)\s*=\s*.* |
Matches JS Variable declarations. |
| COMMENTS | \/\*[\s\S]*?\*\/|\/\/.*/ |
Matches code comments (Single & Multi). |
| JSON | "([^"]+)":\s*"([^"]+)" |
Matches Key-Value pairs in JSON. |
| TEXT | ^\s+|\s+$ |
Whitespace Trimming: Start and End. |
| TEXT | \s{2,} |
Matches duplicate spaces (for collapsing). |
| TEXT | \b(\w+)\s+\1\b |
Duplicate word finder (e.g., "the the"). |
| LOGIC | (?<=A)B |
Lookbehind: Matches B only if after A. |
| LOGIC | A(?=B) |
Lookahead: Matches A only if followed by B. |
| MATH | ^-?\d*\.{0,1}\d+$ |
Matches Floating point numbers. |
| GEOGRAPHY | ^[-+]?([1-8]?\d(\.\d+)?|90(\.0+)?),\s*[-+]?(180(\.0+)?|((1[0-7]\d)|([1-9]?\d))(\.\d+)?)$ |
GPS Lat/Long Coordinates. |
| EXTRACT | (?<=\().*?(?=\)) |
Extracts content strictly inside Parentheses (). |
| EXTRACT | (?<=\[).*?(?=\]) |
Extracts content strictly inside Brackets []. |
| NUMBERS | \d{1,3}(,\d{3})*(\.\d+)? |
Formatted numbers with commas (e.g., 1,250.50). |
| SECURITY | \b(UNION|SELECT|INSERT|DELETE|DROP)\b |
SQL Injection: Detects risky SQL keywords. |
| SECURITY | (['"])(?:(?!\1)[^\\]|\\.)*\1 |
Matches Quoted Strings (Detects injection points). |
| CLEANING | <[^>]*> |
Strip HTML Tags: Converts HTML to plain text. |
| TELECOM | ^\+?94\d{9}$ |
Sri Lankan Mobile Number (+94XXXXXXXXX). |
| TELECOM | ^\+?\d{1,3}?[- .]?\(?(?:\d{2,3})\)?[- .]?\d\d\d[- .]?\d\d\d\d$ |
International Phone Number (Global format). |
| DEV OPS | ^[a-zA-Z_]+[a-zA-Z0-9_]*=.*$ |
.env / Environment Variable key-value pairs. |
| NETWORK | ^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$ |
Domain Name validation (e.g., Oat-calo.com). |
| SYSTEM | \/([^\/\0]+) |
Unix File Path extraction. |
| MARKDOWN | ^#{1,6}\s.*$ |
Matches Markdown Headings (H1 to H6). |
| MARKDOWN | \[(.*?)\]\((.*?)\) |
Matches Markdown Links [Text](URL). |
| MARKDOWN | (\*\*|__)(.*?)\1 |
Matches **Bold** or __Bold__ text. |
| INPUT | ^[a-zA-Z\s]*$ |
Alpha Only: Rejects numbers/symbols (Name fields). |
| INPUT | ^[a-zA-Z0-9]*$ |
Alphanumeric: No spaces or special characters. |
| ASCII | [^\x00-\x7F]+ |
Matches non-ASCII characters (Unicode/Emojis). |
| WEB DEV | <link.*?href=["'](.*?)["'] |
Extracts CSS Stylesheet links. |
| WEB DEV | <script.*?src=["'](.*?)["'] |
Extracts JS Script source URLs. |
| SPACING | [\r\n]+ |
Newline/Linebreak detector (CRLF). |
| LOGIC | \b(\w+)\b(?=.*?\b\1\b) |
Finds words that appear more than once in a string. |
| PASSWORD | ^.{12,}$ |
Enforces minimum 12-character length. |
| ID | \b\d{16}\b |
Generic 16-digit Serial / Card ID. |
| GEOGRAPHY | [A-Z]{1,2}[0-9][A-Z0-9]? [0-9][A-Z]{2} |
UK Postcode validation. |
| MATH | ^\d+(\.\d{1,2})?$ |
Matches Positive Decimals (max 2 places). |
| MATH | \(([^()]+|(?R))*\) |
Recursive: Matches nested parentheses. |
| CODE JS | function\s+([a-zA-Z_$][0-9a-zA-Z_$]*) |
Extracts JavaScript Function names. |
| JSON | \[\s*(\{.*?\})\s*\] |
Matches an array of JSON objects. |
| GIT | [0-9a-f]{7,40} |
Matches Git Commit Hashes (Short or Long). |
| CLEANING | &[a-z]+; |
Matches HTML Entities (e.g., &). |
| BOOKS | ^(?:ISBN(?:-13)?:?\s*)?(?=[0-9]{13}$|(?=(?:[0-9]+[-\s]){4})[-\s0-9]{17}$)97[89][-\s]?[0-9]{1,5}[-\s]?[0-9]+[-\s]?[0-9]+[-\s]?[0-9]$ |
ISBN-13 validation (International Books). |
| AUTOMOTIVE | \b[(A-H|J-N|P|R-Z|0-9)]{17}\b |
VIN (Vehicle Identification Number) matcher. |
| PASSPORT | ^[A-Z][0-9]{8}$ |
Generic Passport Number (1 Alpha + 8 Digits). |
| CODE PY | def\s+([a-zA-Z_][a-zA-Z0-9_]*)\s*\(.*?\)\s*: |
Extracts Python Function definitions. |
| CODE PY | import\s+([a-zA-Z0-9_.,\s]+) |
Matches Python Import statements. |
| CODE PY | f(['"])(.*?)\1 |
Matches Python f-strings. |
| CODE PHP | \$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]* |
Matches PHP Variable names (starting with $). |
| CODE PHP | <\?php[\s\S]*?\?> |
Matches entire PHP Code blocks. |
| CODE JAVA | public\s+static\s+void\s+main |
Locates Java Main Method entry point. |
| CODE C# | namespace\s+([a-zA-Z0-9._]+) |
Matches C# Namespace declarations. |
| API | Bearer\s+[A-Za-z0-9-_=]+\.[A-Za-z0-9-_=]+\.?[A-Za-z0-9-_.+/=]* |
JWT (JSON Web Token) in Auth Headers. |
| API | [a-f0-9]{32} |
MD5 Hash detection (Common for API keys). |
| WEB | <iframe.*?src=["'](.*?)["'] |
Extracts Iframe source URLs. |
| TEXT | \b[A-Z][a-z]+\b |
Matches Title Case words. |
| TEXT | [A-Z]{2,} |
Matches ALL CAPS words (min 2 chars). |
| TEXT | [a-z0-9]+(?:-[a-z0-9]+)* |
Matches kebab-case strings. |
| TEXT | [a-z]+(?:[A-Z][a-z]+)* |
Matches camelCase strings. |
| LOGS | \d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2} |
Standard Server Log Timestamp. |
| SYSTEM | [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4} |
Email Address (Simplified System Check). |
| NETWORK | (?:[a-fA-F0-9]{1,4}:){7}[a-fA-F0-9]{1,4} |
IPv6 Address validation. |
| SECURITY | <script\b[^>]*>([\s\S]*?)<\/script> |
XSS Detection: Matches Script tags/content. |
| SECURITY | javascript:[\s\S]* |
XSS Detection: Matches javascript: pseudo-protocol. |
| CREDIT CARD | ^3[47][0-9]{13}$ |
American Express card validation. |
| CREDIT CARD | ^6(?:011|5[0-9]{2})[0-9]{12}$ |
Discover card validation. |
| FINANCE | [A-Z]{3}\s?\d+(\.\d{2})? |
International Currency (e.g., LKR 5000.00). |
| SCIENCE | [-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+) |
Scientific Notation (e.g., 6.022e23). |
| MATH | \d+°\s?\d+'\s?\d+"\s?[NSEW] |
Degree/Minute/Second Coordinates. |
| FILES | ^.*\.(mp3|wav|ogg|flac)$ |
Audio file extension detector. |
| FILES | ^.*\.(mp4|mkv|avi|mov)$ |
Video file extension detector. |
| FILES | ^.*\.(zip|rar|7z|tar\.gz)$ |
Archive/Compressed file detector. |
| DOCKER | ^[a-z0-9]+(?:[._-][a-z0-9]+)*$ |
Validates Docker Image names. |
| K8S | [a-z0-9]([-a-z0-9]*[a-z0-9])? |
Kubernetes Label/Namespace validation. |
| SSH | ssh-(rsa|dss|ed25519)\s+[A-Za-z0-9+/]+=? |
Detects SSH Public Keys. |
| SQL | ALTER\s+TABLE\s+(\w+)\s+ADD\s+(\w+) |
Matches SQL "Add Column" statements. |
| SQL | SELECT\s+(?:.*?)\s+FROM\s+(\w+) |
Extracts Table Name from a SELECT query. |
| MONGODB | ^[a-f\d]{24}$ |
Matches MongoDB ObjectId. |
| SECURITY | (?i)api[_-]?key[:=]\s*[A-Za-z0-9-_]{16,} |
Detects leaked API Keys in code/logs. |
| SECURITY | (?i)password\s*=\s*['"][^'"]+['"] |
Detects hardcoded credentials. |
| SECURITY | (0x)?[0-9a-fA-F]{40} |
Matches Ethereum Wallet addresses. |
| TEXT | \b[a-z0-9]+(?:_[a-z0-9]+)*\b |
Matches snake_case identifiers. |
| TEXT | \b[A-Z][a-z0-9]+(?:[A-Z][a-z0-9]+)*\b |
Matches PascalCase identifiers. |
| TEXT | \s+$ |
Finds trailing whitespace at EOL. |
| HTTP | ^HTTP\/\d\.\d\s+(\d{3}) |
Extracts HTTP Status Codes from response. |
| WEB | (?i)user-agent:\s*(.*) |
Extracts User-Agent string from headers. |
| URL | \?(?:[^=&]+=[^&]+&?)+ |
Matches URL Query Parameter strings. |
| DATETIME | \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?Z |
Matches ISO 8601 UTC Timestamps. |
| DATE | (0[1-9]|[12][0-9]|3[01])/(0[1-9]|1[012])/(19|20)\d\d |
Matches DD/MM/YYYY date format. |
| TIME | [0-2][0-9]:[0-5][0-9]:[0-5][0-9] |
Matches HH:MM:SS (24-hour). |
| FINANCE | ^[A-Z]{2}\d{2}[A-Z0-9]{11,30}$ |
IBAN (International Bank Account Number). |
| FINANCE | \b[A-Z]{4}[A-Z]{2}[A-Z0-9]{2}([A-Z0-9]{3})?\b |
SWIFT / BIC Bank Code. |
| POSTAL | \b\d{5}(?:-\d{4})?\b |
US Zip Code (Standard & Plus4). |
| CODE C++ | #include\s+[<"](.*?)[\d>"] |
Matches C++ Header Includes. |
| CODE C++ | (std::)?cout\s*<<\s*.*?; |
Matches C++ Print statements. |
| LOGIC | (?m)^.*$ |
Matches entire line (Multiline mode). |
| LOGIC | \b\w+\b(?!\s) |
Matches word not followed by space. |
| UNICODE | [\u4e00-\u9fa5] |
Matches Chinese characters. |
| SHIPPING | \b(1Z ?[0-9A-Z]{3} ?[0-9A-Z]{3} ?[0-9A-Z]{2} ?[0-9A-Z]{4} ?[0-9A-Z]{3} ?[0-9A-Z])\b |
UPS Tracking Number detector. |
| SHIPPING | \b(\d{4} ?\d{4} ?\d{4} ?\d{3})\b |
FedEx Tracking Number (15 digits). |
| CSS | \.([a-zA-Z0-9_-]+)\s*\{ |
Matches CSS Class declarations. |
| CSS | @media\s+.*?\{ |
Matches CSS Media Queries. |
| HTML | <!--[\s\S]*?--> |
Matches HTML Comments. |
| FILES | ^[a-zA-Z0-9._-]+\.[a-zA-Z0-9]+$ |
Validates safe filename strings. |
| FILES | \.(csv|xlsx|json|xml)$ |
Matches Data file extensions. |
| MATH | \d+\/\d+ |
Matches Fractions (e.g., 3/4). |
| MATH | [πΣ√∞∫] |
Detects common Math symbols. |
| CODE RUBY | def\s+([a-z_][a-z0-9_]*[\?\!]?) |
Matches Ruby Method names. |
| CODE SWIFT | func\s+([a-zA-Z_][a-zA-Z0-9_]*) |
Matches Swift Function declarations. |
| CLEANING | [\u0000-\u001F\u007F-\u009F] |
Finds hidden Control Characters. |
| TEXT | \b(\w+)\b(?:\s+\1\b)+ |
Finds repeated words (e.g., "test test"). |
| COLOR | hsl\(\s*\d+\s*,\s*\d+%\s*,\s*\d+%\s*\) |
Matches HSL Color values. |
| ID | \b\d{10}\b |
Matches generic 10-digit IDs. |
| NETWORK | \d{1,5} |
Matches Port Numbers (0-65535). |
| LOGIC | (?<=\=).* |
Extracts everything after "=" sign. |
| MARKDOWN | ^>\s(.*) |
Matches Markdown Blockquotes. |
| MARKDOWN | `{3}[\s\S]*?`{3} |
Matches Markdown Code Blocks. |
| DEV | (TODO|FIXME|OPTIMIZE):?.* |
Finds developer annotations in code. |
| WEB | <title>(.*?)<\/title> |
Extracts Meta Title from HTML. |
| SECURITY | ^[a-fA-F0-9]{64}$ |
Matches SHA-256 Hashes. |
| TEXT | [^\w\s] |
Matches any Special Character (non-word/space). |
| FILES | \.ico$ |
Detects Favicon files. |
| ID | [0-9]{3}-[0-9]{2}-[0-9]{4} |
US Social Security Number (SSN). |
| FINANCE | \d{9} |
Routing Number (ABA) for US Banks. |
| MEDICAL | ^[A-Z][0-9]{2}\.?[0-9]{0,4}$ |
ICD-10 Diagnosis Codes. |
| TELECOM | \d{15} |
IMEI Number (Mobile Hardware ID). |
| LOGIC | (?<!un)available |
Negative Lookbehind: "available" NOT preceded by "un". |
| LOGIC | q(?!u) |
Negative Lookahead: "q" NOT followed by "u". |
| LOGIC | ^(?=.*[a-z])(?=.*[A-Z]).+$ |
Must contain both Upper and Lower case. |
| AWS | arn:(aws|aws-us-gov|aws-cn):[a-zA-Z0-9\-]+:.* |
AWS ARN (Amazon Resource Name). |
| AZURE | [0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12} |
Azure Subscription/Tenant ID. |
| DOCKER | FROM\s+([a-zA-Z0-9/._-]+)(?::([a-zA-Z0-9._-]+))? |
Extracts Base Image from Dockerfile. |
| WEB | <meta\s+name=["']description["']\s+content=["'](.*?)["'] |
Extracts Meta Description for SEO. |
| WEB | <meta\s+property=["']og:(.*?)["']\s+content=["'](.*?)["'] |
Extracts OpenGraph (Social Media) tags. |
| WEB | (#[a-fA-F0-9]{3}){1,2} |
Matches CSS Hex Colors in shorthand/full. |
| CLEAN | [^\x20-\x7E] |
Matches all non-printable ASCII characters. |
| CLEAN | \t+ |
Matches Tab characters (useful for conversion). |
| TEXT | ^.{0,280}$ |
X (Twitter) Character Limit Check. |
| CODE GO | func\s+\(.*\)\s+([a-zA-Z0-9]+)\(.*?\) |
Matches Go Method Receivers. |
| CODE RUST | fn\s+([a-z_][a-z0-9_]*)\s*<?.*?>?\( |
Matches Rust Function definitions. |
| CODE R | ([a-zA-Z0-9.]+)\s*<-\s*function |
Matches R Language functions. |
| FILES | \.dwg$|\.dxf$ |
AutoCAD/Engineering file extensions. |
| FILES | \.iso$|\.img$|\.dmg$ |
Disk Image extensions. |
| FILES | \.py[cod]$ |
Python Compiled files (to ignore in Git). |
| POWER | \d+(\.\d+)?\s?(V|mA|W|Hz) |
Electrical units (Volts, Watts, etc.). |
| STORAGE | \d+(\.\d+)?\s?(KB|MB|GB|TB|PB) |
Data storage units. |
| MATH | ^0x[0-9a-fA-F]+$ |
Hexadecimal number validation. |
| MATH | ^[0-7]+$ |
Octal number validation. |
| GEOMETRY | POINT\(\d+(\.\d+)?\s\d+(\.\d+)?\) |
WKT (Well-Known Text) Point matching. |
| SECURITY | eval\(base64_decode\(.*\) |
Detects common PHP Malware obfuscation. |
| SECURITY | <iframe.*?style=["'].*?display:\s*none.*?> |
Detects Hidden Iframes (Malicious redirect). |
| SECURITY | powershell\.exe\s+-e(nc)?\s+[A-Za-z0-9+/=]+ |
Detects Encoded PowerShell commands. |
| LOGIC | \{((?>[^{}]+)|(?R))*\} |
Matches balanced curly braces (Recursion). |
| LOGIC | <(\w+).*?>.*?<\/\1> |
Matches balanced HTML tags (Capture groups). |
| SERIAL | [A-Z]{3}-\d{4}-[A-Z]{1}\d{2} |
Matches legacy enterprise serial formats. |
| ID | \d{3}-\d{3}-\d{4} |
Matches generic dash-separated IDs. |
| URL | ^(?!mailto:)(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,}))\.?)(?::\d{2,5})?(?:[/?#]\S*)?$ |
Extreme URL validator (RFC compliant). |
| CLEAN | \x1B\[[0-9;]*[mK] |
Strip ANSI Color Codes from terminal output. |
| TEXT | (?<=\w)-(?=\w) |
Finds hyphens between words (Dash-check). |
| CLEAN | [\x00-\x08\x0B\x0C\x0E-\x1F\x7F] |
Removes non-XML compatible characters. |
| DEV | (TODO|FIXME|HACK|XXX|BUG) |
Technical debt keyword search. |
| CORE | ^.*$ |
Matches absolutely everything (The Wildcard). |
| CORE | (?!) |
The "Never Match" pattern (Fails instantly). |
| CORE | \b |
Word Boundary (The most powerful anchor). |