title: Regex to find substring and wrap it in tags - Java
body: <p>I'm trying to write code which finds all words that are in the following format</p>
  <pre><code>&quot;some text&quot;:
  </code></pre>
  <p>So alphanumeric characters which are within &quot; symbols and which end with the : symbol. My goal once I find these is to remove the &quot; character and wrap the entire string in  tag. So after the code has run, the above text would look like this,</p>
  <pre><code>&lt;strong&gt;some text:&lt;/strong&gt;
  </code></pre>
  <p>So I believe the regex to find such text for wrapping is the following (formatted for Java),</p>
  <pre><code>(\&quot;.*?\&quot;):{1}
  </code></pre>
  <p>And by using the following code, I should be able to iterate through all the matches.</p>
  <pre><code>Pattern pattern = Pattern.compile(&quot;(\&quot;.*?\&quot;):{1}&quot;);
  Matcher matcher = pattern.matcher(stringToSearch);
  
  while(matcher.find()) {
    String matchedGroup = matcher.group();
    matchedGroup = matchedGroup.replaceAll(&quot;\&quot;&quot;, &quot;&quot;);
    matchedGroup = &quot;&lt;strong&gt;&quot; + matchedGroup + &quot;&lt;/strong&gt;&quot;;
    
    // now what?
  }
  </code></pre>
  <p>So I probably went about that all wrong.</p>
  <p>Now that I've wrapped the word I wanted in a strong tag, how do I &quot;put it back&quot; where it was?</p>