[erlang-bugs] Re bug

Robert Virding <>
Sat Mar 3 00:45:55 CET 2012


I have a pattern a?(n)a(n) where the (n) denotes repetition so a?(3)a(3) is shorthand for a?a?a?aaa. I will call this A(3). Then the pattern A(3) should match the string a(3). Which is does in re where I get (using my shorthand forms):

> re:run(a(3), A(3)).             %re:run("aaa", "a?a?a?aaa").
{match,[{0,3}]}

It also works as expected for bigger n:

> re:run(a(15), A(15)).
{match,[{0,15}]}


all the way up to 22:

> re:run(a(22), A(22)).
{match,[{0,22}]}

but for 23 it fails:

> re:run(a(23), A(23)).
nomatch

I don't see why it fails here as the pattern should match the string. Yes, I know this is a pathological case but I still don't think it should return nomatch. If it is giving up it should say so. Otherwise this is a bug.

Robert


More information about the erlang-bugs mailing list