bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: parenthesised regular expressions and non-greedy operator ? - non st


From: Chet Ramey
Subject: Re: parenthesised regular expressions and non-greedy operator ? - non standard bash behaviour
Date: Sun, 3 Dec 2017 15:23:43 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.4.0

On 12/1/17 12:40 PM, address@hidden wrote:

> Bash Version: 4.4
> Patch Level: 12
> Release Status: release
> 
> Description:
>   I'm sanitising urls from advertisement crap. As described below I'm getting 
> a wrong resolution of parenthesised expression defined with non-greedy 
> operator '?'.
> 
>   The test url is: 
> http://toolbox.contentspread.net/container/medimops/track/xxxxxxxxxx.dyn?csRdu=https://www.medimops.de/?anid=M9999999999&cl=details&wdm=M9999999999&utm_source=CRM&utm_medium=email&utm_campaign=OS
> 
>   The regular expression is: 
> https?:\/\/toolbox.contentspread.net\/(.*?)=(.+?)&.*

The Bash =~ operator uses Posix extended regexps (EREs) as defined in
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_04.
There's no concept of a `non-greedy' operator
in the Posix ERE definition.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]