i want to get an ending html tag like </EM> only if somewhere before it i.e. before any previous tags or text there is no starting <EM> tag my sample string is 
ddd d<STRONG>dfdsdsd dsdsddd<EM>ss</EM>r and</EM>and strong</STRONG>
in this string the output should be </EM> and this also the second </EM> because it lacks the starting <EM>. i have tried 
(?!=<EM>.*)</EM>
but it doesnt seem to work please help thnks