bug-gawk
[Top][All Lists]
Advanced

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

Re: Does gawk manual mention how an empty regex should be handled?


From: Arkadiusz Drabczyk
Subject: Re: Does gawk manual mention how an empty regex should be handled?
Date: Wed, 31 Mar 2021 19:03:42 +0200

On Wed, Mar 31, 2021 at 06:37:46PM +0200, Wolfgang Laun wrote:
> With any of the languages supporting pattern matching I've never read an
> explicit documentation of this behaviour, but it seems kind of logical that
> when /xxx...x/ matches "xxx...x" for any length n, that this also should hold
> for length 0 (but forgive me, I'm a mathematician ;-) )
> -W

Out of curiosity I tried an empty regex in Python:

print(re.search(r"", "abc"))

and grep:

echo abc | grep ""

and it works in both cases but someone here
https://boost-users.boost.narkive.com/PA1Fxdws/regex-empty-regular-expression
said:

"An empty regex has always been an error in Boost.Regex (because I
couldn't think of a legitimate use for it)."

so it looks like there are different approaches to this problem (I
don't know Boost and C++ so I cannot test it on my own).

-- 
Arkadiusz Drabczyk <arkadiusz@drabczyk.org>



reply via email to

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