regexp: how to match a null string?

Chris Pressey <>
Fri Mar 28 07:16:07 CET 2003


On Thu, 27 Mar 2003 18:54:53 -0600
Chris Pressey <> wrote:

> In my mind, "^(.*)$" should match a null string.
> It doesn't match any characters, but it's still a valid match.
> But because regexp deals only in terms of characters matched -
> there's no way to tell!

In lieu of a better solution... attached is a patch to regexp.erl which
adds the function

  is_match(String, RegExp) -> true | false | {error, Reason}

-Chris

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: regexp.patch
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20030328/dd315fef/attachment.ksh>


More information about the erlang-patches mailing list