How To Search For The Second Occurence Of ' Or " In Regex?
String combinations: str_search = adfa odf 'aso' str_search = do o sfo o'sfsdf' str_search = sdfosd'sf sd' What i've done so far: if( /\s*\S*['|']\s*\S*['|']$/.test(str_search) )
Solution 1:
Well, from your updates, it seems that you can use something a bit like this:
str = "adfa odf 'aso'";
if(/(?:'[^']+'|"[^"]+")$/.test(str)){
res = str.replace(/(?:'[^']+'|"[^"]+")$/, "!string!");
alert(res);
}
Post a Comment for "How To Search For The Second Occurence Of ' Or " In Regex?"