title: Bash regex match
body: <p>I want to match a line using a regular expression, but can quiet see why it won't work.</p>
  
  <p>To explain my situation: say i have a script like this:</p>
  
  <pre><code>text="/location/whatever/
  /some-other-stuff/
  /this-is-what-i-need-1/
  /this-is-what-i-need-2/
  /this-is-what-i-need-3/
  /some-other-random-stuff"
  
  #now loop through it:
  while read -r line
  do
      if [[ "$line" =~ '\/[a-zA-Z\-]*[0-9]+\/' ]]
      then
          #do whatever you like
      fi
  done &lt;&lt;&lt; "$text"
  </code></pre>
  
  <p>I now want to only match lines in the form of "this-is-what-i-need-".
  My first regex would've been this: <code>\/[a-zA-Z\-]*[0-9]+\/</code> but it doesn't seem to match any of these lines. I really would like to understand why that is so.</p>