bug-grep
[Top][All Lists]
Advanced

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

[sr #107314] grep -P with whitespace match wraps around end of lines


From: Rupert Brooks
Subject: [sr #107314] grep -P with whitespace match wraps around end of lines
Date: Sat, 20 Mar 2010 19:48:17 +0000
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.43 Safari/532.5

URL:
  <http://savannah.gnu.org/support/?107314>

                 Summary: grep -P with whitespace match wraps around end of
lines
                 Project: grep
            Submitted by: rupert
            Submitted on: Sat 20 Mar 2010 07:48:16 PM GMT
                Category: None
                Priority: 5 - Normal
                Severity: 3 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
        Operating System: GNU/Linux

    _______________________________________________________

Details:

When matching something using the perl compatibility mode with the whitespace
matcher (\s), the whitespace matcher MAY match around the end of line in some
circumstances.  An example, and system and version identification follows.

I'm unsure if this is designed behavior.  In any case it differs from Perl
behavior.

<PRE>
address@hidden:~/development/regular_expressions$ cat somelines.txt
aba
abba
abbba
stuff
12345
I like beans
ab+a
Silliness of expressions
        beans with tab
        beans with no tab

beans
   blahbeansblah


address@hidden:~/development/regular_expressions$ grep -P '\sbeans\s'
somelines.txt
I like beans
ab+a
        beans with tab
        beans with no tab

beans
   blahbeansblah
address@hidden:~/development/regular_expressions$ perl -ne 
'if($_=~/\sbeans\s/) {print $_;}' somelines.txt
I like beans
        beans with tab
        beans with no tab
address@hidden:~/development/regular_expressions$ uname -a
Linux morrigan 2.6.31-17-generic #54-Ubuntu SMP Thu Dec 10 17:01:44 UTC 2009
x86_64 GNU/Linux
address@hidden:~/development/regular_expressions$ grep --version
GNU grep 2.5.4

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.

</PRE>







    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/support/?107314>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

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