[erlang-questions] Regex to match an empty string

Michael McDaniel <>
Tue Feb 24 00:34:37 CET 2009


$ erl
Erlang (BEAM) emulator version 5.6.5 [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.6.5  (abort with ^G)
1> re:run("", "^$").
{match,[{0,0}]}
2> q().

$


~M


On Tue, Feb 24, 2009 at 12:31:21PM +1300, Vik Olliver wrote:
> 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
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions

-- 
Michael McDaniel
Portland, Oregon, USA
http://autosys.us




More information about the erlang-questions mailing list