Other Resources:
Exact n times repetition quantifier {n}
What is the exact n times repetition quantifier? How to use it?
How to write a regular expression using a repetition quantifier to capture Visa card numbers that have 16 digits like this: 4111111111111111?
✍: FYIcenter.com
![]()
The "exact n times" repetition quantifier allows us to repeat a pattern unit exactly n times in the matching process. The "exact n times" repetition quantifier is '{n}' and it needs be placed immediately after the pattern unit. For example:
\d{2}-\d{2}-\d{4} # matches date strings in mm-dd-yyyy format
The regular expression to capture 16-digit Visa card numbers is:
4\d{15}
4 - matches '4', the starting digit of all Visa numbers
\d{15} - repeating \d exactly 15 times
2013-01-26, 0👍, 0💬
Popular Posts:
Are you having problems using regular expressions when processing text strings in your applications ...
All credit card numbers issued by JCB have 3 sets of numbers: JCB cards start with 2131 have 15 digi...
All credit card numbers issued by Diners Club must start with 300 through 305, 36 or 38 and have 14 ...
According to the IEEE 802 specification, a MAC address has 6 groups of 2 hexadecimal digits separate...
How to capture the Soso Spider entries from Web log file? Here are some Web log file entries: 127.0....