Skip Menu |

This queue is for tickets about the YAPE-Regex CPAN distribution.

Report information
The Basics
Id: 6043
Status: new
Priority: 0/
Queue: YAPE-Regex

People
Owner: Nobody in particular
Requestors: blair [...] orcaware.com
Cc:
AdminCc:

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



Subject: Minor bug in class regex
Hello, I found a minor bug in the regular expression for a class: class => qr{ \\ ([Pp]) ( [A-Za-z] | \{ [a-zA-Z]+ \} ) | \[ ( \^? ) ( \]? [^][\ \]* (?: (?: \[:\w+:\] | \[ (?!:) | \\. ) [^][\\]* )* ) \] }x, The problem occurs when you interpolate this variable into the regular expression with the ^. if ($self->{CONTENT} =~ s/^$pat{class}//) Because the second | is not in a () pair, the re effectively looks like this: ^ \\ ([Pp]) ( a and z stuff ) | more stuff So the string '\p{dvfdvfd}' will match and ' \p{dvfdvfd}' will not, but '[01[:alpha:]%]' will match and ' [01[:alpha:]%]' will match. It looks like a precendence issue where | has lower precendence. So the whole regex needs to be placed in a (?:) or probably simpler, just put a ^ after the second |. Best, Blair