[erlang-questions] Regex to match an empty string

Robert Virding rvirding@REDACTED
Tue Feb 24 01:18:11 CET 2009


Can't you instead just pattern match the string against "" or [] (they are
equal)? Using regular expressions for so simple patterns is really overkill.

Robert

P.S. Yes that is probably a bug.

2009/2/24 Vik Olliver <vik@REDACTED>

> I'm trying to spot a parameter that is an empty string. The weapon of
> choice is regexp:first_match/2 which is used in the code that parses the
> config file.
>
> In other worlds, "^$" matches an empty string. In Erlang, not so:
>
> 5> regexp:first_match("","^$").
> nomatch
>
>
> What do I use instead?
>
> Vik :v)
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090224/d5bf084d/attachment.htm>


More information about the erlang-questions mailing list