I have a regex that needs to be checked. The regex has double quotes in it, but I can't figure out how to avoid them correctly.
The first attempt does not work because quotation marks are not escaped.
while read line do if [[ $line =~ "<a href="(.+)">HTTP</a>" ]]; then SOURCE=${BASH_REMATCH[1]} break fi done < tmp/source.html echo "{$SOURCE}"
How can I run this correctly so that the output is link.html without double quotes.
I tried...
while read line do if [[ $line =~ "<a href=/"(.+)/">HTTP</a>" ]]; then SOURCE=${BASH_REMATCH[1]} break fi done < tmp/source.html echo "{$SOURCE}"
No luck. Can someone please help me so that I can stop banging my head on my table? I'm not big with bash. Thanks!
jayem
source share