[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GNU grep back references
From: |
Jan Schampera |
Subject: |
Re: GNU grep back references |
Date: |
Mon, 10 Oct 2005 14:40:53 +0200 |
On Mon, 10 Oct 2005 12:59:46 +0100
Julian Foad <address@hidden> wrote:
> paragraph from section 9.2:
>
> "[...] Some utilities employing regular expressions limit the
> processing to lines; [...]. Those utilities (like grep) that do not
> allow <newline>s to match are responsible for eliminating any
> <newline> from strings before matching against the RE. [...]"
>
> From the Single UNIX Specification v2 Grep page
> <http://www.opengroup.org/onlinepubs/007908799/xcu/grep.html>,
> Description, second paragraph:
>
> "[...] since patterns are matched against individual lines of the
> input [...]"
I looked at grep description for that, but it seems i didn't look for
the right keywords. Excuse that. This paragraph specifies it very clear.
> It seems that SVR4's Grep, if it is intentionally treating the whole
> input as one long string, is in any case wrongly taking the
> back-reference to refer to the _first_ string matched by the
> subexpression.
With my new information I fully agree with that.
We found that behaviour by some user asking for matching numbers like
used in my example, and we couldn't find a clear answer which behaviour
the standard-writers *expected*.
> I hope this helps and shows that GNU Grep is doing the right thing.
See above.
Also, to clarify that: It wasn't meant as "GNU grep is wrong", if it
sounded like that.
Thanks a lot for this extended answer,
Jan
--
I know life sometimes can get tough! and I know life sometimes can be a
drag! But people, we have been given a gift, we have been given a road
And that roads name is... rock and roll!
KISS in "God gave Rock'n'Roll to you"