|
From: | Pierre Chartier |
Subject: | Re: [bug-gawk] Numerical repeat is broken. |
Date: | Thu, 23 Feb 2012 08:49:35 -0500 |
Thanks,
I think my problem was due to the fact that the restriction on availability was not mentioned along with the feature itself in the documentation. After a thorough examination of the manual, it was clear, of course. Having a comment about applicability alongside the description of the concept itself would have been nice.
The following nearby comment:
In POSIX awk and gawk, the ‘*’, ‘+’, and ‘?’ operators stand for themselves when there is nothing in the regexp that precedes them. For example, /+/ matches a literal plus sign. However, many other versions of awk treat such a usage as a syntax error.
Does not quite cover the restriction about {n}
Best regards
Pierre
-----Original Message-----
From: Aharon Robbins [mailto:address@hidden]
Sent: Wednesday, February 22, 2012 4:03 PM
To: address@hidden; address@hidden
Cc: address@hidden
Subject: Re: [bug-gawk] Numerical repeat is broken.
FWIW, matching interval expressions is now enabled by default, starting with gawk 4.0.0.
Arnold
> From: "Pierre Chartier" <address@hidden>
> To: "'Andrew J. Schorr'" <address@hidden>
> Date: Fri, 17 Feb 2012 13:40:05 -0500
> Cc: address@hidden
> Subject: Re: [bug-gawk] Numerical repeat is broken.
>
> Thank you very much.
>
> Pierre Chartier
>
> -----Original Message-----
> From: Andrew J. Schorr [mailto:address@hidden
> Sent: Friday, February 17, 2012 12:12 PM
> To: Pierre Chartier
> Cc: address@hidden
> Subject: Re: [bug-gawk] Numerical repeat is broken.
>
> On Thu, Feb 16, 2012 at 03:23:01PM -0500, Pierre Chartier wrote:
>
> BEGIN {
> printf "Matching v01.02.002\n"
> if("v01.02.002" ~ /v[0-9]{2}\.[0-9]{2}\.[0-9]{3}/) {printf "1 matches\n"}
> if("v01.02.002" ~ /v[0-9]*\.[0-9]*\.[0-9]*/) {printf "2 matches\n"}
> if("v01.02.002" ~ /v[0-9][0-9]\.[0-9]*\.[0-9]*/) {printf "3 matches\n"}
> if("v01.02.002" ~ /v[0-9]{2}\.[0-9]*\.[0-9]*/) {printf "4 matches\n"}
> if("v01.02.002" ~ /v[0-9]{2}\.[0-9]{2}\.[0-9]*/) {printf "5
> matches\n"} }
>
> For this to work with gawk, you will need the --re-interval argument:
>
> --re-interval
> Allow interval expressions in regexps, even if `--traditional' has
> been provided. (`--posix' automatically enables interval
> expressions, so `--re-interval' is redundant when `--posix' is is
> used.)
>
> Regards,
> Andy
>
[Prev in Thread] | Current Thread | [Next in Thread] |