I need to match and replace some comments. for example:
$test = \"the url is http://www.google.com\";// comment \"<-- that quote needs to be matched
In complement of @Thai answer which I found very good, I would like to add a bit more:
In this example using original regex only the last character of quotes will be matched: https://regex101.com/r/CoxFvJ/2
So I modified a bit to allow capture of full quotes content and give a more talkative and generic example of content: https://regex101.com/r/CoxFvJ/3
So final regex:
/"((?:\\"|[^"])*)"|'((?:\\'|[^'])*)'|(\/\/.*|\/\*[\s\S]*?\*\/)/g
Big thanks to Thai for unlocking me.