I'm trying to come up with a regular expression which will wrap all occurences of JJDnnnnnnnnnnnnnnnn
within a string with an anchor pointing to an url which contains the matched string in the query string.
I suck at regexps :(
I'm trying to come up with a regular expression which will wrap all occurences of JJDnnnnnnnnnnnnnnnn
within a string with an anchor pointing to an url which contains the matched string in the query string.
I suck at regexps :(
To replace JJD with exactly 16 digits after it, you could say
str.replace(/(JJD[0-9]{16})/gi,"<a href='somepage.html/foo?value=$1'>$1</a>");
if you don't need exactly 16 digits, but need something like 10-20 digits, you could say
str.replace(/(JJD[0-9]{10,20})/gi,"<a href='somepage.html/foo?value=$1'>$1</a>");