Regex Tester
Java Regex Tester
Section titled “Java Regex Tester”DQS uses Java-compatible regular expressions (java.util.regex.Pattern) for Validity checks and PII Detection patterns. Use this tester to validate your patterns before configuring them in the Builder.
/ /
Enter a regex and test string above.
Useful Patterns for DQS
Section titled “Useful Patterns for DQS”Validity Patterns
Section titled “Validity Patterns”| Pattern Name | Regex | Description |
|---|---|---|
^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$ | Standard email format | |
| Phone (International) | ^\+?[1-9]\d{1,14}$ | E.164 international phone format |
| Phone (US) | ^\(?[2-9]\d{2}\)?[\s.\-]?\d{3}[\s.\-]?\d{4}$ | US phone with optional formatting |
| URL | ^https?://[^\s/$.?#].[^\s]*$ | HTTP/HTTPS URL |
| ZIP Code (US) | ^\d{5}(-\d{4})?$ | US ZIP code (5 or 9 digit) |
| Postal Code (UK) | ^[A-Z]{1,2}\d[A-Z\d]?\s*\d[A-Z]{2}$ | UK postal code |
| Postal Code (DE) | ^\d{5}$ | German postal code |
| ISO Date | ^\d{4}-\d{2}-\d{2}$ | YYYY-MM-DD format |
| ISO DateTime | ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2} | ISO 8601 datetime |
| Currency (USD) | ^\$?\d{1,3}(,\d{3})*(\.\d{2})?$ | US dollar format |
| Percentage | ^\d{1,3}(\.\d{1,2})?%?$ | Percentage value (0-100) |
| Alphanumeric | ^[a-zA-Z0-9]+$ | Letters and digits only |
| No Special Chars | ^[a-zA-Z0-9\s.\-,]+$ | Letters, digits, spaces, basic punctuation |
| Salesforce ID (15) | ^[a-zA-Z0-9]{15}$ | 15-character Salesforce ID |
| Salesforce ID (18) | ^[a-zA-Z0-9]{18}$ | 18-character Salesforce ID |
| Domain Name | ^([a-zA-Z0-9\-]+\.)+[a-zA-Z]{2,}$ | Valid domain name |
| IPv4 Address | ^(\d{1,3}\.){3}\d{1,3}$ | IPv4 address format |
| Hex Color | `^#([0-9a-fA-F]3 | [0-9a-fA-F]6)$` |
PII Detection Patterns
Section titled “PII Detection Patterns”| Pattern Name | Regex | Description |
|---|---|---|
| SSN (US) | \b\d{3}-\d{2}-\d{4}\b | Social Security Number |
| SSN (unformatted) | \b\d{9}\b | 9 consecutive digits (potential SSN) |
| Credit Card (Visa) | \b4\d{3}[\s\-]?\d{4}[\s\-]?\d{4}[\s\-]?\d{4}\b | Visa card number |
| Credit Card (MC) | \b5[1-5]\d{2}[\s\-]?\d{4}[\s\-]?\d{4}[\s\-]?\d{4}\b | Mastercard number |
| Credit Card (Amex) | \b3[47]\d{2}[\s\-]?\d{6}[\s\-]?\d{5}\b | American Express number |
| Credit Card (Generic) | \b\d{4}[\s\-]?\d{4}[\s\-]?\d{4}[\s\-]?\d{4}\b | Any 16-digit card pattern |
| IBAN | \b[A-Z]{2}\d{2}[A-Z0-9]{4}\d{7}([A-Z0-9]?){0,16}\b | International Bank Account Number |
| Passport (US) | \b[A-Z]\d{8}\b | US passport number |
| PESEL (PL) | \b\d{11}\b | Polish national ID (11 digits) |
| NIP (PL) | \b\d{3}-?\d{3}-?\d{2}-?\d{2}\b | Polish tax ID |
| REGON (PL) | \b\d{9}\b | Polish business registry number |
| Date of Birth | `\b(0[1-9] | 1[0-2])/(0[1-9] |
| Email in text | [a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,} | Email anywhere in text (no anchors) |
| Phone in text | \b(\+?\d{1,3}[\s\-]?)?\(?\d{3}\)?[\s\-]?\d{3}[\s\-]?\d{4}\b | Phone number in free text |
| IP Address | \b(\d{1,3}\.){3}\d{1,3}\b | IPv4 address in text |
| Driver License (US) | \b[A-Z]\d{3,8}\b | US driver license (varies by state) |
- Anchored patterns (
^...$) validate the entire field value — use for Validity checks - Unanchored patterns (no
^/$) find matches within text — use for PII Detection - Apex regex is case-sensitive by default. Use
(?i)at the start for case-insensitive matching - Test edge cases: empty strings, whitespace-only values, and Unicode characters