Skip Menu |

This queue is for tickets about the Regexp-Assemble CPAN distribution.

Report information
The Basics
Id: 123645
Status: open
Priority: 0/
Queue: Regexp-Assemble

People
Owner: Nobody in particular
Requestors: GUIDO [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.38
Fixed in: (no value)



Subject: Incorrect handling of "x++x"
Regexp::Assemble compiles "x++x" into /x+\+x/ but the second plus sign should not be escaped. The correct regex /x++x/ can never match, but /x+\+x/ matches for example "x+x" or "xxx+x". A similar problem exists for "x**x". That gets compiled into "x*\*x" which matches "whatever*x". But /x**x/ is syntactically wrong and should not match anything.
Subject: Re: [rt.cpan.org #123645] Incorrect handling of "x++x"
Date: Tue, 21 Nov 2017 09:51:27 +1100
To: bug-Regexp-Assemble [...] rt.cpan.org
From: Ron Savage <ron [...] savage.net.au>
Hi Guido Did you try calling unroll_plus(1)? It might help. On 17/11/17 01:15, Guido Flohr via RT wrote: Show quoted text
> Thu Nov 16 09:15:41 2017: Request 123645 was acted upon. > Transaction: Ticket created by GUIDO > Queue: Regexp-Assemble > Subject: Incorrect handling of "x++x" > Broken in: 0.38 > Severity: (no value) > Owner: Nobody > Requestors: GUIDO@cpan.org > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=123645 > > > > Regexp::Assemble compiles "x++x" into /x+\+x/ but the second plus sign should not be escaped. > > The correct regex /x++x/ can never match, but /x+\+x/ matches for example "x+x" or "xxx+x". > > A similar problem exists for "x**x". That gets compiled into "x*\*x" which matches "whatever*x". But /x**x/ is syntactically wrong and should not match anything. >
-- Ron Savage - savage.net.au
Sure, unroll_plus() may work. But it's disabled by default and that means that the default behavior is broken. I'm not using the module and am not affected by the problem. The question popped up, when I was commenting an answer on stackoverflow: https://stackoverflow.com/questions/47330247/predicting-proper-regular-expression-from-seeing-target-string/47330389#47330389 I used /x++x/ as an example of a regular expression that can never match, and later saw that Regexp::Assemble actually processed it incorrectly. So feel free to close the issue. It's mostly academic.
Subject: Re: *****SPAM***** [rt.cpan.org #123645] Incorrect handling of "x++x"
Date: Fri, 24 Nov 2017 08:41:45 +1100
To: bug-Regexp-Assemble [...] rt.cpan.org
From: Ron Savage <ron [...] savage.net.au>
Hi Guido Thanx for the feedback. I plan to spend time in December finishing off my new module Regexp::Parsertron, which might offer a replacement for Regexp::Assemble. On 21/11/17 22:00, Guido Flohr via RT wrote: Show quoted text
> Queue: Regexp-Assemble > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=123645 > > > Sure, unroll_plus() may work. But it's disabled by default and that means that the default behavior is broken. > > I'm not using the module and am not affected by the problem. The question popped up, when I was commenting an answer on stackoverflow: https://stackoverflow.com/questions/47330247/predicting-proper-regular-expression-from-seeing-target-string/47330389#47330389 > > I used /x++x/ as an example of a regular expression that can never match, and later saw that Regexp::Assemble actually processed it incorrectly. > > So feel free to close the issue. It's mostly academic. >
-- Ron Savage - savage.net.au
Perhaps https://metacpan.org/release/Regexp-Parsertron will help in some way.