To get the closest starting tag to ThisIsImportant use a negative
assertion on the tag itself.  
/<tag>(?:(?!<tag>).)*ThisIsImportant.*?<\/tag>/  
Formatted:
 <tag>
 (?:
      (?! <tag> )
      . 
 )*
 ThisIsImportant
 .*? 
 </tag> 
0
solved Perl Regex – Search and replace between tags only if string is in-between [closed]