I am trying to follow Bash Cookbook to learn about Bash Scripting. I am on example 6.8 Testing with Regular Expression. I have the following script:#!/usr/bin/env bash# cookbook filename: trackmatchfor CDTRACK in *do     if [[ $CDTRACK =~ ([[:alpha:][:blank:]]*)- ([[:digit:]]*) - (.*)$ ]]then    echo ${BASH_REMATCH[2]}else    echo Error $CDTRACKfidoneI apply this to a couple of files in my directory:Ludwig van Beethovern - 02 - Adagio un poco mosso.oggLudwig van Beethovern - 01 - Allegro.oggI always get an error returned. The issue appears to be with ([[:alpha:][:blank:]]*)- ([[:digit:]]*) - section of code. When I do have the if statement as: if [[ $CDTRACK =~ (.*)$ ]] then there is no error.Any thoughts as to what I am doing wrong?I am running the code on AWS, Bash v 4.2
Pattern matching
bash;shell script;regular expression;patterns