I’m trying to write a reg exp that matches the following code in a JSP:
="<%= "Index: " + index %>"
However if I write it in a general manner expressions on the same line that match this end up being combined:
value="<%= "items[" + Index + "].selected" %>" id="<%= "Checkbox" + Index %>"
Can someone help me figure out the reg exp to recognise the value and id tags separately so that I can put a search replace in to replace the outer double quotes with single quotes please?
Thanks,
Alexei Blue.
P.s.
So far I have this which isn ‘t specific enough:
"=<%=.*".*".*%>"
If you want to match the whole “<% %>” element including quotes, no matter what’s inside the tag (apart from %) I would use this regex:
You will probably need to escape the quotes in the code like this:
\"What it says is:
EDIT:
If you are specifically interested only in the elements which have double quotes inside – use this:
([^%]*"){2}: match everything that’s not % (optional) and a double quote – repeat twice[^%]+: match any remaining characters