title: Return a regex match in a Bash script, instead of replacing it
body: <p>I just want to match some text in a Bash script. I've tried using sed but I can't seem to make it just output the match instead of replacing it with something.</p>
  
  <pre><code>echo -E "TestT100String" | sed 's/[0-9]+/dontReplace/g'
  </code></pre>
  
  <p>Which will output <code>TestTdontReplaceString</code>.</p>
  
  <p>Which isn't what I want, I want it to output <code>100</code>.</p>
  
  <p>Ideally, it would put all the matches in an array.</p>
  
  <p>edit:</p>
  
  <p>Text input is coming in as a string:</p>
  
  <pre><code>newName()
  {
   #Get input from function
   newNameTXT="$1"
  
   if [[ $newNameTXT ]]; then
   #Use code that im working on now, using the $newNameTXT string.
  
   fi
  }
  </code></pre>