help-gawk
[Top][All Lists]
Advanced

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

Re: warning: regexp constant for parameter #1 yields boolean value


From: Andrew J. Schorr
Subject: Re: warning: regexp constant for parameter #1 yields boolean value
Date: Thu, 4 Aug 2022 16:05:34 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

Hi,

Yeah -- we really need a sample program demonstrating the problem to understand
exactly what the issue is.

Good luck,
Andy

On Thu, Aug 04, 2022 at 03:46:12PM -0400, J Naman wrote:
> Gawk ver 5.1.1 (mingw) api3.1 GNU MP 6.1.2 GNU MPFR 4.0.2
> gensub() works for everything else. I use gensub() about 20 times in the same
> program. Just this one thing is driving me nuts. Maybe it is something
> upstream, like an extra or missing { ( ) } or an extra ;; can cause problems.
> I'll delete lines until it goes away or ends up stand-alone. 
> Thanks, john
> 
> On Thu, Aug 4, 2022 at 2:23 PM Andrew J. Schorr <
> aschorr@telemetry-investments.com> wrote:
> 
>     On Thu, Aug 04, 2022 at 12:52:25PM -0400, Andrew J. Schorr wrote:
>     > Hi,
>     >
>     > On Thu, Aug 04, 2022 at 11:39:23AM -0400, J Naman wrote:
>     > > I am sorry, I do not understand what this warning means in this case.
>     > > code:
>     > > r0=gensub(/([0-9])[,]([0-9])/,"\\1\\2","g",r0);
>     > > warning: regexp constant for parameter #1 yields boolean value
>     > > # want "1,234,567" => "1234567"
>     >
>     > Can you please share a full example of the problem you're trying to
>     > solve, as well as the platform and gawk version?
>     >
>     > On my system, I do not see any such issue:
>     >
>     > bash-4.2$ ./gawk -v r0=1,234,567 'BEGIN 
> {r0=gensub(/([0-9])[,]([0-9])/,"\
>     \1\\2","g",r0); print r0}'
>     > 1234567
>     > bash-4.2$ ./gawk --lint -v r0=1,234,567 'BEGIN {r0=gensub(/([0-9])[,]
>     ([0-9])/,"\\1\\2","g",r0); print r0}'
>     > gawk: cmd. line:1: warning: `gensub' is a gawk extension
>     > 1234567
>     >
>     > This is using gawk from the master branch.
> 
>     Ah, I can duplicate the problem like this:
> 
>     bash-4.2$ /bin/gawk --traditional -v r0=1,234,567 'BEGIN {r0=gensub(/
>     ([0-9])[,]([0-9])/,"\\1\\2","g",r0); print r0}'
>     gawk: cmd. line:1: warning: regexp constant for parameter #1 yields 
> boolean
>     value
>     gawk: cmd. line:1: fatal: function `gensub' not defined
> 
>     Are you invoking gawk with --traditional or using a version of awk that
>     does not have a gensub function?
> 
>     Regards,
>     Andy



reply via email to

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