I need to match all // occurrences in a string in a Javascript regex
It cannot match /// or /
I still have (.*[^\/])\/{2}([^\/].*)
which is basically "something that is not /, followed by //, followed by something that is not /"
The approach seems to work separately from when the line I want to match starts with //
This does not work:
//Example
It does
material // example
How to solve this problem?
Edit: a little more context - I'm trying to replace // with !, so I use:
result = result.replace(myRegex, "$1 ! $2");
source
share