title: regex in bash expression
body: <p>I have 2 questions about regex in bash expression.<br></p>
  
  <p>1.non-greedy mode</p>
  
  <pre><code>local temp_input='"a1b", "d" , "45"'
  if [[ $temp_input =~ \".*?\" ]]
  then
      echo ${BASH_REMATCH[0]}
  fi
  </code></pre>
  
  <p>The result is </p>
  
  <pre><code>"a1b", "d" , "45"
  </code></pre>
  
  <p>In java</p>
  
  <pre><code>String str = "\"a1b\", \"d\" , \"45\"";
  Matcher m = Pattern.compile("\".*?\"").matcher(str);
  while (m.find()) {
      System.out.println(m.group());
  }
  </code></pre>
  
  <p>I can get the result below.</p>
  
  <pre><code>"a1b"
  "d"
  "45"
  </code></pre>
  
  <p>But how can I use non-greedy mode in bash?<br>
  I can understand why the \"[^\"]<em>\" works.<br>
  But I don't understand why does the \".</em>?\" do not work.</p>
  
  <p>2.global matches<br></p>
  
  <pre><code>local temp_input='abcba'
  if [[ $temp_input =~ b ]]
  then
      #I wanna echo 2 b here. 
      #How can I set the global flag?
  fi
  </code></pre>
  
  <p>How can I get all the matches?<br>
  ps:I only wanna use regex.</p>
  
  <p>For the second question, sorry for the confusing.<br>
  I want to echo "b" and "b", not count "b".</p>
  
  <p>Help!</p>