On Fri, Dec 01, 2017 at 06:40:35PM +0100, d...@computer42.org wrote: > I'm sanitising urls from advertisement crap. As described below I'm getting > a wrong resolution of parenthesised expression defined with non-greedy > operator '?'.
> re='https?:\/\/toolbox.contentspread.net\/(.*?)=(.+?)&.*' > > if [[ ${url} =~ ${re} ]] Bash's =~ operator uses Extended Regular Expressions. There is no non-greedy operator (.*? or .+?) in an ERE. It's a perl extension. Also, you don't need to escape / but you *do* need to escape dots.