I'm having a hard time looking for some info about regexes and I'm still struggling with it.
Let say we have this:
0123 4567 8910
The example has spaces but they can be -
or ,
or +
or something which is not a number.
I'm trying to get 10 digits (or 5 or 11), detected individually, ignoring every other character different from a digit.
Using this: [0-9] matches ever digit, I know. If I do something like this [0-9]{10} would never check anything since this pattern is looking for all 10 digits to be together and I need the regex to count those 10 one by one no matter if something different from a digit is in the string...
I was working with this regex: [0-9](?=(?:[^0-9]*[0-9]){4,16}(?![^0-9]*[0-9]))
The thing is this detects everything but the last 4 digits and not the specific 10 I need... Any advice on this would be highly appreciated...
EDIT
I was able to do it... in the other way, I mean, I was able to leave 10 unmarked characters... I need to do the oposite in the way this regex is working:
[0-9](?=(?:[^0-9]*[0-9]){10,}(?![^0-9]*[0-9]))
Here's the example.
This is the goal. With a regex, get 5, 10 or 12 first characters like this (example 12 char):