title: Find all delimiters next to substring in string and replace in python
body: <p>Sample string:</p>
  
  <pre><code>s = "&lt;sec&gt;John&lt;/sec&gt; said hi to a woman (named &lt;sec&gt;Mary)&lt;/sec&gt;"
  </code></pre>
  
  <p>I need to transform this to:</p>
  
  <pre><code>s = "&lt;sec&gt;John&lt;/sec&gt; said hi to a woman (named &lt;sec&gt;Mary&lt;/sec&gt;)"
  </code></pre>
  
  <p>This would need to work on both the start and end tag and for all delimiters like ".", ",", "-", "(", ")" and so on.</p>
  
  <p>I could just do a search and replace for ")" and so on, but obviously I would like something a bit more sexy.</p>
  
  <p>So basically move all delimiters outside the  tag.</p>
  
  <p>Thanks!</p>