I have this regular expression to look for phone numbers in a codebase:
\\\\d{3}[\\.\\s-]?\\d{3}[\\.\\s-]?\\d{4}\\g
How can I modify this so th
Lookahead and lookbehind will help you with these restrictions - if they are supported, like
/(?<!\d)\d{3}[.\s-]?\d{3}[.\s-]?\d{4}(?!\d)/g
You can replace the lookbehind (?<!\d) with (?:^|\D) if it is not supported. You can replace the lookahead (?!\d) with (?:\D|$) if it is not supported.
You can find a demo here: https://regex101.com/r/aS8jQ8/1