+ 1
I need some help with Regex.... Javascript
I'm working on a code called "Code beautifier", but I have a problem with regex. code = code.replace(code.match(/(\/\/).+(?=(\<br\>\<\/br\>))/g), "<span class='comment'>" + code.match(/(\/\/).+(?=(\<br\>\<\/br\>))/g) + "</span>"); (Note: This is on a whole line, not separated) But it replaces only the furst occurence, not all the other, any suggestions how I could replace all occurences? Thank you!
2 Antworten
+ 2
Check this and let me know if it works.
https://code.sololearn.com/W6XlLn9uw68c/#js
0
thank you! That 'll work!