I am trying to match 10 digit phone numbers (that start with 2-9) that are on word boundaries (i.e. there is white space around them.) Sometimes the above phone numbers are prefixed with an +1 or 1
I would like it to still match the 10 digit phone number that follows but discard the +1 or 1 There can be multiple phone numbers in the text. Here is my regexp
\b(([+]?[1-9]{1})?([2-9][0-9]{9}))\b
https://regex101.com/r/yS1vM4/1
Shows matches. However it doesn't match for the first row of numbers and it should NOT match on the 2nd and last row:
abcd +12125551212 xyz should match starting at 212
abcd +2125551212 xyz should NOT match (+ sign only)
abcd 2125551212 xyz match OK!
abcd+12125551212 xyz should NOT match (no white space at start)
abcd 12125551212 xyz should match starting at 212
Thank you