![]() |
escaping single quote with regex
Hi, I am having trouble trying to get my intended results from this code:
Code:
torrentlink=($(sed -rn "/target=/s/.*href=\"([^\"]+)\".*>.*\.${vars[1]}\.torrent.*/\1/p" "$html")) I believe I am not correct in trying to escape the single quote, but there is an array defined term in the variable, so this makes the coding even more difficult. Another question that I have is whether the . for file extension needed backslash to escape, because they seem to be working fine with or without backslashes. THanks, Ted |
I haven't looked at the sed command (others here can do that better than I) but, assuming this is in a bash script,
Code:
torrentlink=($(sed <whatever>)) Assuming you want the output of the sed command in variable torrentlink: Code:
torrentlink=$(sed <whatever>) Code:
sed <whatever> |
Thanks, I solved by using both double and single quotes:
Code:
torrentlink=($(sed -rn '/target=/s/.*href="([^"]+)".*>.*\.'"${vars[1]}"'\.torrent.*/\1/p' "$html")) Thanks, Ted |
All times are GMT -5. The time now is 07:48 PM. |