I’m trying to find and replace a string within a classname.
I’m using a function wich returns me the “metadata” of a class:
e.g:
class="atestclass {action : '/myurl/param1/param2'}"
So the function metadata.action would return me “/myurl/param1/param2”.
Now i need to change this value with regexp in a generic way.
So this is my RegExp and of course it dont work 🙁
var regExp = new RegExp(opts.attribute + '\'.\'','igm');
“opts.attribute” is in this case “action”. Now I need to find the firt occurence of the quotes after “opts.attribute” and replace this with “opts.value”.
I have no idea how to do it, RegExp a my personal nightmare :-/
1 Answer