Bash: Regex for finding pattern having double quotes
<p>I am trying to use regex in my shell script to find a substring.</p>

<p>Original string:</p>

<pre><code>"relative-to="jboss.server.base.dir" scan-enabled="true" scan-interval="0""
</code></pre>

<p>Trying to find following substring:</p>

<pre><code>"scan-enabled="true""
</code></pre>

<p>Code:</p>

<pre><code>str="relative-to=\"jboss.server.base.dir\" scan-enabled=\"true\" scan-interval=\"0\""
reg='scan-enabled.*"'
[[ "$str" =~ $reg ]] &amp;&amp; echo $BASH_REMATCH
</code></pre>

<p>but it is returning,</p>

<pre><code>scan-enabled="true" scan-interval="0"
</code></pre>

<p>Can someone please help on how to search for a pattern involving double quotes using regex?</p>

<p>Bash version: 4.1.2(1)-release</p>