title: Find last word in path and remove brackets with regex using bash
body: <p>I have done lots of searching on SO and google.</p>
  
  <p>I am using a regex tester like <a href="https://regex101.com/" rel="nofollow noreferrer">Regex 101</a>.</p>
  
  <p>The test string is <code>[../../dvl/namespaces/my-namespace-1/notterminating]</code></p>
  
  <p>The <code>regex</code> I am using is <code>.*\/([^\/]*)[\[\]']+</code>.</p>
  
  <p>What I am trying to do (returns empty):</p>
  
  <pre><code>$ param="[../../dvl/namespaces/my-namespace-1/notterminating]"
  $ echo $param | grep ".*\/([^\/]*)[\[\]']+"
  </code></pre>
  
  <p>I have tried different options with grep by adding different flags like <code>-o</code>, <code>-e</code>, etc. I have tried <code>"${param}.*\/([^\/]*)[\[\]']+"</code>. However, I have been unsuccessful at getting bash to recognize my regex.</p>