In my html content, i want to replace all “bold” text with “italic” existing in between script tag using c#.
I have two option here for applying regular expression
a) replace all between script tag
b) replace all before the ending of script tag
So what will be the regular expression using any method?
Something like this (untested!):
UPDATE:
I got the non-greedy flag wrong. somehow I thougt it was ‘@’, but in fact it is ‘?’. The fixed pattern:
You could replace the ‘*’ with a ‘+’ to only match non-empty script tags.
UPDATE #2: the ‘@’ was in my head because of the VisualStudio regex “Find” – it’s the non-greedy version of ‘*’ for VisualStudio’s “Find in Files”