title: check that string starts and ends with a specific pattern in Lua
body: <p>I have a table which is having string values </p>
  
  <pre><code>data_table = {'(?P&lt;smartcache&gt;.+)$', 'css', '123454', '(?P&lt;version&gt;.+)$'}
  </code></pre>
  
  <p>I am trying to see if a string <code>startswith</code> '(?P&lt;' and <code>endswith</code> ')$' .
  I want a string in output which will be like</p>
  
  <pre><code>output_table = '/smartcache/css/123454/version'
  </code></pre>
  
  <p>I am facing problem to fetch values which are passed with patterns
  like I want to fetch <code>'smartcache'</code> from  <code>(?P&lt;smartcache&gt;.+)$</code>.</p>
  
  <p>My Try:</p>
  
  <pre><code>out_string_value = (string.match(uri_regex, '[^(?P&lt;].+[)$]')
  </code></pre>
  
  <p>here I am getting output as <code>smartcache&gt;.+)$</code> but I want <code>smartcache</code>.</p>