[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bug in 1.4.5 with regexp
From: |
Karl Nelson |
Subject: |
Bug in 1.4.5 with regexp |
Date: |
Tue, 08 Aug 2006 10:24:54 -0700 |
According to the documentation a warning is issued if there are "fewer"
sub-expressions than requested. Unfortunately, the
newest version of gnu m4 has interpreted it to mean if any of the
subexpressions evaluate to empty even when they are present in
the regular expression. This seems like a bug.
From the documentation:
"If replacement is supplied, and there was a match, regexp changes the
expansion to this argument, with `\n' substituted by the text matched by
the nth parenthesized sub-expression of regexp, up to nine sub-expressions.
The escape `\&' is replaced by the text of the entire regular expression
matched. For all other characters, `\' treats the next character literally.
A warning is issued if there were fewer sub-expressions than the `\n'
requested, or if there is a trailing `\'. If there was no match, regexp
expands to the empty string. "
bug.m4:
regexp(`abc',`\([*&]\)?\(.*\)',`ifelse(\1,,Form 1 \1,Form 2 \2)')
[kenelson ~/]$ m4 bug.m4
bug.m4:1: m4: Warning: sub-expression 1 not present
bug.m4:1: m4: Warning: sub-expression 1 not present
Form 1
--Karl
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Bug in 1.4.5 with regexp,
Karl Nelson <=