knaselk Posted April 19, 2013 Share Posted April 19, 2013 Hello all, I've been using a script to replace registered names in their proper cases with a registered mark. s = ReplaceSubstring(s, "Biospot", "<span>" + "bioSpot" + "<f name=\"Arial\">" + "<p br=false superoffset=188 superratio=25><superscript>® </superscript>" + "</span>"); Is there a way to search/replace any text that is "biospot" regardless of its case? I've noticed the data I receive is not consistent, i.e. "biospot", "BIOSPOT", "BIOspot". The correct text should always be "bioSpot" thanks for any help! Quote Link to comment Share on other sites More sharing options...
esmith Posted April 19, 2013 Share Posted April 19, 2013 s = s.replace(/biospot/ig, "<span>bioSpot<f name=\"Arial\"><p br=false superoffset=188 superratio=25><superscript>® </superscript></span>"); the replace() method will search for the string between the forward slashes and replace it with what is in quotes. The "i" after the forward slashes indicates the search term is case insensitive while the "g" indicates that the find & replace should occur as many times as necessary in the original string. Quote Link to comment Share on other sites More sharing options...
knaselk Posted April 19, 2013 Author Share Posted April 19, 2013 Very good to know! Thank you so much! Quote Link to comment Share on other sites More sharing options...
dreimer Posted April 19, 2013 Share Posted April 19, 2013 Thanks for the explanation, good to know what some of that stuff actually does!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.