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


_______________________________________________
Bug-m4 mailing list
Bug-m4@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-m4

Reply via email to