So currently I am trying to add a feature to a userscript I have made.Currently the userscript will get some text into a variable. Now there are also have 2 vars, that currently are for adding text to the begenning and end of the text in the first var. Here is a code sample to make you better understand what it is currently doing\[code\]elmTextarea.value = http://stackoverflow.com/questions/9713404/opening + elmTextarea.value + closing;\[/code\]Where elmTextarea is the string that the userscript got and opening and closing are the things I put in the beginning and end of it.Now, what I want to happen is that if the variable elmTextarea includes any [quote*]blahblahblah[/quote] it essentially will exclude those areas(not the star could be anything, it is in the format\[code\]
/gim, closingquote);\[/code\]but adding these lines into my code makes my whole script not work. Any ideas as to why this does not work and how to fix it.name said:)\[/code\]but could also be just" + opening;elmTextarea.value = http://stackoverflow.com/questions/9713404/opening + elmTextarea.value + closing;elmTextarea.value = elmTextarea.value.replace(/[quote/gim, openingquote);elmTextarea.value = elmTextarea.value.replace(/So here is a quick example so you can better understandif elmTextarea is\[code\]blahblahere is some morename said:some more textand finally this text\[/code\]it would become\[code\]opening + blahbla + closingname said:some more text in hereopening + here is some more + closingname said:some more textopening + and finally this text + closing\[/code\]So I have an idea as to how this would work, and here is my attempted implementation\[code\]var openingquote = closing + "[quote";var closingquote = "name said:some more text in here