Is there any regex I can use to match blocks of exactly 10 digits? For instance, I have this:
/\d{10}(?!\d+)/g
And this matches 2154358383
when given 2154358383
fine, but is also matches 1213141516
when given 12345678910111213141516
, which I don't want.
What I think I need is a look-behind assertion (in addition to my lookahead already in there), that checks to make sure the character preceding the match is not an integer, but I can't figure out how to do that.
I tried
/(?:[^\d]+)\d{10}(?!\d+)/g
But that broke my first match of 2154358383
, which is bad.
How can I write this to only match groups of 10 integers (no more, no less) with unknown boundaries?
I should also note that I'm trying to extract these out of a much larger string, so ^
and $
are out of the question.