[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] Numerical repeat is broken.
From: |
Pierre Chartier |
Subject: |
Re: [bug-gawk] Numerical repeat is broken. |
Date: |
Fri, 17 Feb 2012 13:40:05 -0500 |
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