title: Extract a substring from value of key-value pair using regex
body: <p>I have a string in log and I want to mask values based on regex.</p>
  
  <p><strong>For example</strong>:</p>
  
  <pre><code>"email":"testEmail@test.com", "phone":"1111111111", "text":"sample text may contain email testEmail@test.com as well"
  </code></pre>
  
  <p>The regex should mask </p>
  
  <ol>
  <li>email value - both inside the string after "email" and "text"</li>
  <li>phone number</li>
  </ol>
  
  <p><strong>Desired output</strong>:</p>
  
  <pre><code>"email":"*****", "phone":"*****", "text":"sample text may contain email ***** as well"
  </code></pre>
  
  <p>What I have been able to do is to mask email and phone individually but not the email id present inside the string after "text". </p>
  
  <p><strong>Regex developed so far</strong>:</p>
  
  <pre><code>(?&lt;=\"(?:email|phone)\"[:])(\")([^\"]*)(\")
  </code></pre>
  
  <p><a href="https://regex101.com/r/UvDIjI/2/" rel="nofollow noreferrer">https://regex101.com/r/UvDIjI/2/</a></p>