title: how to get jdk version from the download string in bash script
body: <p>I have the below download sting</p>
  <pre><code>javaurl=http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x
  64.tar.gz
  </code></pre>
  <p>I want to get jdk-8u131-linux-x64.tar.gz  so that I can do tar -xvzf on it</p>
  <p>so I tried</p>
  <pre><code>echo `expr match &quot;$javaurl&quot; '\(.[jdk]*.tar.gz\)'`
  </code></pre>
  <p>but I did not find it</p>
  <p>I tried in ansible</p>
  <pre><code>name: Download Java to Latest Version
        shell: |
                mkdir /opt/java
                cd /opt/java
                wget -c --header &quot;Cookie: oraclelicense=accept-securebackup-cookie&quot; {{javaurl}}
                tar -xzvf &quot;{{{javaurl##*/}}}&quot;
  </code></pre>
  <p>but it throwing error</p>
  <pre><code>&quot;msg&quot;: &quot;template error while templating string: unexpected char '#' at 130. String: mkdir /opt/java\ncd /opt/java\nwget -c --header \&quot;Cookie: oraclelicense=accept-securebackup-cookie\&quot; {{javaurl}}\ntar -xzvf \&quot;{{{javaurl##*/}}}\&quot;\n&quot;}
  </code></pre>