buggrep - Bugs: bug #32412, Error parsing a pattern including...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #32412: Error parsing a pattern including "( ??? |+)"

Submitted by:  -Deleted Account- <asenci>
Submitted on:  Thu 10 Feb 2011 11:18:11 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Invalid
Privacy: PublicAssigned to: None
Open/Closed: Closed

Mon 28 Feb 2011 08:38:34 AM UTC, comment #1:

The plus is a special character in extended regular expressions, so whenever you want to treat it as a literal "+" you should escape it. Even though grep will sometimes try to second guess syntactically invalid regular expressions, the correct solution is to use '^(-|\+)RA$' as you did.

Paolo Bonzini <bonzini>
Thu 10 Feb 2011 11:18:11 AM UTC, original submission:

Trying to run grep with Extended Regex and a pattern including "( ??? |+)" causes a parsing error on version 2.6.3. The issue couldn't be reproduced in version 2.5.1.

It seams the plus is qualifying the pipe, so it's trying to match a string with one or more pipes (|, ||, |||, ...).

$ grep -V
GNU grep 2.6.3

Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

$ echo "-RA" | grep -Eq '^(-|+)RA$' && echo OK
grep: Unmatched ) or \)
$ echo "-RA" | grep -Eq '^(+|-)RA$' && echo OK
OK
$ echo "-RA" | grep -Eq '^(-|\+)RA$' && echo OK
OK

$ grep -V
grep (GNU grep) 2.5.1

Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ echo "-RA" | grep -Eq '^(-|+)RA$' && echo OK
OK
$ echo "-RA" | grep -Eq '^(+|-)RA$' && echo OK
OK

-Deleted Account- <asenci>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by bonzini (Posted a comment)
  • -unavailable- added by asenci (Submitted the item)
  • -unavailable- added by asenci
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 28 Feb 2011 08:38:34 AM UTCbonziniStatusNone=>Invalid
      Open/ClosedOpen=>Closed
    Thu 10 Feb 2011 11:18:11 AM UTCasenciCarbon-Copy-=>Added asenci

    Back to the top


    Powered by Savane 3.1-cleanup1