javascript - JS Regex: Replace all but first -
this question exact duplicate of:
how can make regex replaces occurrences of word first?
have webpage loads of text , header @ top. want make regex replaces occurrences of word first because don't want header change.
var count = 0; text = text.replace(myregex, function(match) { count++; if(count==1) { return match; } else { return myreplacedvalue; } });
Comments
Post a Comment