title: Can I find and replace multiple field codes with plain text, while retaining the value that the field refers to?
body: <p>By 'the value which the field refers to', I am referring to the text which is between the { }.</p>
  
  <p><strong>What I have</strong></p>
  
  <p>Currently, I have many hyperlinks in pages of text like this:</p>
  
  <p><a href="http://www.google.com" rel="nofollow noreferrer">Testing 123</a> and test <a href="http://www.yahoo.com" rel="nofollow noreferrer">321</a>.</p>
  
  <p><strong>What I hope for</strong></p>
  
  <p>I want to find and replace every instance of hyperlink field codes with plain text. Specifically, I want the ouput to look like this, in every case: *www.hyperlink.com</p>
  
  <p><strong>What I have tried</strong></p>
  
  <p>So far, I have been able to select the field in question, with the hyperlink by putting the following in the 'Find' form: HYPERLINK "*"</p>
  
  <p>However, I am unsure what to put into the replace field in order to update the text as desired, with manually copying each link, then replacing with '^c' in each case. Since I have over 100 pages of link dense text, this is not feasible. I have also tried to use the wildcard and replace with the text: * but the wildcard doesn't seem to recognise that it is algebraically equivelant to the 'find' form's wildcard.</p>
  
  <p>The closest I come is when I try:
  Find: HYPERLINK "(*)"
  Replace:  \1 
  With the option 'use wildcards' checked.</p>
  
  <p>While it moved the hyperlinks to between the ref tags, and banished the HYPERLINK text, the curly brackets { } where kept. So, when I switched out of form field mode (Alt F9) the www.ExampleHyperlink.com dissapears, because it's considered a Form Field thingo!</p>
  
  <p>When I put the curly brackets in the 'find' field, the search fails - so I'm guessing I can't search for them, in order to replace them.</p>
  
  <p><strong>Possible code?</strong></p>
  
  <pre><code>Sub Macro3()
  '
  ' Macro3 Macro
  '
  '
      Selection.Find.ClearFormatting
      Selection.Find.Replacement.ClearFormatting
      With Selection.Find
          .Text = "HYPERLINK ""(*)"""
          .Replacement.Text = "\1"
          .Forward = True
          .Wrap = wdFindContinue
          .Format = False
          .MatchCase = False
          .MatchWholeWord = False
          .MatchAllWordForms = False
          .MatchSoundsLike = False
          .MatchWildcards = True
      End With
      Selection.Find.Execute replace:=wdReplaceAll
  End Sub
  </code></pre>
  
  <p><strong>Response to MacroPod</strong></p>
  
  <p>Thanks!</p>
  
  <p>Now, I am able to banish the Hyperlink field code, and retain the hyperlink :)</p>
  
  <p>I combine your macro with following macro/step to add the text  and  around each URL:</p>
  
  <pre><code>Sub Macro1()
  '
  ' Macro1 Macro
  '
  '
      Selection.Find.ClearFormatting
      Selection.Find.Replacement.ClearFormatting
      With Selection.Find
          .Text = "(&lt;http://*.com&gt;)"
          .Replacement.Text = "&lt;ref&gt;\1&lt;/ref&gt;"
          .Forward = True
          .Wrap = wdFindContinue
          .Format = False
          .MatchCase = False
          .MatchWholeWord = False
          .MatchAllWordForms = False
          .MatchSoundsLike = False
          .MatchWildcards = True
      End With
      Selection.Find.Execute replace:=wdReplaceAll
      With Selection.Find
          .Text = "(&lt;www.*.com&gt;)"
          .Replacement.Text = "&lt;ref&gt;\1&lt;/ref&gt;"
          .Forward = True
          .Wrap = wdFindContinue
          .Format = False
          .MatchCase = False
          .MatchWholeWord = False
          .MatchAllWordForms = False
          .MatchSoundsLike = False
          .MatchWildcards = True
      End With
      Selection.Find.Execute replace:=wdReplaceAll
  End Sub
  </code></pre>
  
  <p>It works almost perfectly, except that any part of the URL after the '.com' is missed. For instance, if the URL is: '<a href="https://www.google.com/intl/en_us/health/about/" rel="nofollow noreferrer">https://www.google.com/intl/en_us/health/about/</a>' then the output is:</p>
  
  <pre><code>'&lt;ref&gt; https://www.google.com &lt;/ref&gt; /intl/en_us/health/about/' 
  </code></pre>
  
  <p>which is not quite what I'm going for because I'd like the second ref tag to come after the last part of the URL. Another issue is that whatever the anchor text was that linked to the URL dissapears. Ideally, it would come immediately prior to the  tag. That's because something is usually linked like this: a <a href="http://www.pictureofacooldog.com" rel="nofollow noreferrer">cooldog</a> is always cool. I really appreciate your assistance. Any idea how I can deal with this?</p>