RegEx = new RegExp(sourcevalue, "gi");
temp[i] = Selectors[i].cssText.replace(RegEx, targetvalue);
where sourcevalue = rgb(255,0,0) and targetvalue = #FFFFFF, but sourcevalue is not replaced by targetvalue, why?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Because sourcevalue is a correct Javascript regular expression but it’s not working the way you expected. There are special characters in regular expression like the () parentheses. They are used to group parts of regular expressions. To use them with their “literal” meaing you’ll have to escape them using backslashes