I am working on a project where I need to replace any phone number on a site with a number formatted like this:
<span id="special-id">555-666-7777</span>
Using regex isn't really necessary as I know the value I need to replace. Also, some of the numbers may be formatted differently (with parentheses or decimals).
I'm fairly certain I could figure out how to do this with Jquery but, for this project, I need to use regular Javascript.
In a nutshell, I'd like to define 1 or more versions of the number ( 555-666-7777, (555) 666-7777, etc ) and have them replaced with my hyphenated version of the number, in a SPAN tag, with an ID.
etc.is very important here, you need to list the different variations. Aregexor other pattern matching is necessary, because you have multiple versions to replace,.