[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] In Regexps, Extra (Unmatched) Closing Parentheses Does No

From: arnold
Subject: Re: [bug-gawk] In Regexps, Extra (Unmatched) Closing Parentheses Does Not Produce Error Message, Treated Literally
Date: Mon, 10 Jun 2019 00:13:28 -0600
User-agent: Heirloom mailx 12.5 7/5/10


Things are indeed working as they're supposed to be. I will add a note
in the manual about how unmatched parentheses work.



"Neil R. Ormos" <address@hidden> wrote:

> In a regexp, an unmatched left parenthesis
> provokes an error message.
>  > ./gawk '/(abc/{ print "ok" };'
>  gawk: cmd. line:1: error: Unmatched ( or \(: /(abc/
> An unmatched right parenthesis does not provoke an
> error message, and it must be matched literally.
>  > echo "/abc"  | gawk '/abc)/{ print "ok" };'
>  [no output]
>  > echo "/abc)" | gawk '/abc)/{ print "ok" };'
>  ok
> This behavior is the same as grep's, so I assume
> this is not an error, but rather an intended
> behavior of the regexp library...
> ... but it would be nice if there were some hint
> in the manual that a right parenthesis is treated
> as special only when there's a matching left
> parenthesis.  (Apologies in advance if it's there,
> and I just missed it.)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]