Some expressions do not match the preferred template. You will see the following message when customizing an expression.
Click the image to enlarge.
Example 1: All - Credit Card numbers
[^\w-.;&](\d{14,19}|\d{4}[-. ]\d{4}[-. ]\d{4}[-. ]\d{4}([-. ]\d{3})?|\d{4}[-. ]\d{6}[-. ]\d{4,5})[^\w-.;&]
Where:
- [ ] - a character set. Match any character that is on the set.
- [^] - negated set. Match any character that is not on the set.
- [^\w-.;&] - a word and -.;& will not be included on matching
- \w - Word. Matches any word character
- [-.;&] - If enclosed on a character set will match the characters specifically.
- [-.;&*$abcd123] - will match any of the specified characters inside the set.
- () - Capturing Group. Groups multiple tokens together.
- \d - Any Digit ranging from 0-9
- {} - Quantifier.
- \d{4} match 4 of the preceding token (1234)
- \d{5} match 5 of the preceding token (18909)
- \d {4,5} match between 4 and 5 of the preceding token. (1234 or 12345)
- | - Alternation. Boolean OR
- \s - Whitespace.
Example 2: Australia - Tax File Number (TFN)
[^\w-.;&](\d{8,9})[^\w-.;&]
Where:
- [^\w-.;&] - a negated set. A word and characters -.;& will not be included in matching.
- (\d{8,9}) - 8 or 9-digit tax file number
Example 3: India - Permanent Account Number (PAN)
[^\w\-]([A-Z]{3}[CPHFATBLJG][A-Z]\d{4}[A-Z])[^\w\-]
Where:
- [A-Z]{3} - 3 characters ranging A-Z
- [CPHFATBLJG] - a character that is one of “CPHFATBLJG”
- [A-Z] - one character ranging from A-Z
- \d{4} - a 4-digit number from 0-9
- [A-Z] - one character from A-Z
Example 4: Customized values where keyword is not applicable.
([M][S][1][Y][Q][T][\d{0-9}][\d{0-9}][\d{0-9}][\d{0-9}][\d{0-9}][A-Z][A-Z][\d{0-9}])
Use case
- MS1YQT14000MB9
- MS1YQT14000MC4
Where:
- [M][S][1][Y][Q][T] - are specific permanent characters on a text.
- [\d{0-9}][\d{0-9}][\d{0-9}][\d{0-9}][\d{0-9}] - 4 digit numbers ranging from 0-9
- [A-Z][A-Z] - 2 characters ranging from A-Z
- [0-9] - one digit number