title: java regex to clear mediawiki markup
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2863272/wikipedia-java-library-to-remove-wikipedia-text-markup-removal">Wikipedia : Java library to remove wikipedia text markup removal</a>  </p>
  </blockquote>
  
  
  
  <p>I have to clean some content that comes from Confluence. That content is almost clean; however, there are some things like: </p>
  
  <ol>
  <li>[link|]: A link without the url part</li>
  <li>*[link|]*: A link (without the url part) in bold</li>
  <li>*text*: Bolded text</li>
  <li>_*text*_: italic bolded text </li>
  </ol>
  
  <p>And so on.
  I need to write a regex that clean all that, so, I did something like: </p>
  
  <p><code>String wikiCleanMarkupRegex = "\\\\[(.*?)[\\\\|.*?]?\\\\]|\\\\*(.*?)\\\\*|_(.*?)_";</code></p>
  
  <p>But that doesn't clean everything, I mean, if I give it the link in #2, I will get: </p>
  
  <p>[link|]</p>
  
  <p>Which is not what I want, I want to get "link"... so, I need to reparse the string again and again until no other match is found.</p>
  
  <p>This is really slow because there are millions of records to clean, so, is there any way of doing a regex that does all at once?</p>
  
  <p>Thanks a lot. </p>