Reputation: 2884
I have a 15-digit number followed by a number that can be any length.
For example:
15 digit number + 2 digit number;
15 digit number + 3 digit number;
15 digit number + 10 digit number;
How do I use RegEx to capture the first 15 digits as "Part 1" and the remaining number of digits as "Part 2"?
Upvotes: 0
Views: 73
Reputation: 837986
Try this regular expression:
^(\d{15})(\d+)$
Explanation:
^ Start of string
$ End of string
\d Any digit
{15} Repeat 15 times
+ Repeat one or more times.
(...) Capturing group
Upvotes: 1