How using regexp replace something in code that is not a comment?
..PATTERN.. PATTERN // .. PATTERN ..
to
..ANOTHER.. ANOTHER // .. PATTERN ..
Comments can be // or /* */
Regexp to find comments is:
/\*(.|[\r\n])*?\*/|(//.*)
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.
You can easily do this for single line comments by using a negative lookbehind (but still prone to problem of literal string of the form “….//…..”):
Maybe this could work for multiline:
output:
new string;
/*
* don’t replace
*/
new string;