> On Apr 20, 2018, at 8:03 AM, @lbutlr <krem...@kreme.com> wrote:
> 
> The biggest issue between regex (POSIX) and PCRE is that POSIX regex is 
> greedy. that is, it matches the longest possible left, while PCRE matches the 
> shortest possible left.

That's false (example uses a Bash in-line file):

   $ postmap -q aaa pcre:<(printf '%s\n' '/(a*)(a)/ $1:$2')
   aa:a

however, PCRE does also provide non-greedy "*" and "+" variants:

  $ postmap -q aaa pcre:<(printf '%s\n' '/(a+?)(a)/ $1:$2')
  a:a

  $ postmap -q aaa pcre:<(printf '%s\n' '/(a*?)(a)/ $1:$2')
  :a

-- 
        Viktor.

Reply via email to