[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
doc bug: match function: array argument: example output wrong
From: |
David Chisholm |
Subject: |
doc bug: match function: array argument: example output wrong |
Date: |
Wed, 6 Feb 2002 17:15:48 +0800 |
$ gawk --version
-| GNU Awk 3.1.0
Document: Edition 3 of GAWK: Effective AWK Programming: A User's Guide for
GNU Awk, for the 3.1.0 version of the GNU implementation of AWK.
Section: 9.1.3 String Manipulation Functions
Discussing the match built-in function...
<BEGIN QUOTATION>
If array is present, it is cleared, and then the 0'th element of array is
set to the entire portion of string matched by regexp. If regexp contains
parentheses, the integer-indexed elements of array are set to contain the
portion of string matching the corresponding parenthesized sub-expression.
For example:
$ echo foooobazbarrrrr |
> gawk '{ match($0, /(fo+).+(ba*r)/, arr)
> print arr[1], arr[2] }'
-| foooo barrrrr
<END QUOTATION>
When I ran the above code, the result was:
-| foooo bar
Substituting '(bar*)' for the second parenthesized sub-expression yielded
the expected result.
Regards
--
David Chisholm address@hidden
Technical Analyst - Applications tel. +61 8 9266 4626
Information Management Systems Always remember you're unique,
Curtin University of Technology just like everyone else.
- doc bug: match function: array argument: example output wrong,
David Chisholm <=