regexp match loop on ^+

Fredrik Thulin <>
Tue Apr 13 18:38:56 CEST 2004


Hi

Magnus Ahltorp long ago implemented ENUM (RFC2916) support in Yxa.
ENUM lets you enter for example a SIP URI equivalent with an E.164 number in 
DNS and uses regexps to make it possible to for example have DNS wildcard 
entrys for your phone numbers. Magnus then found a little implementation 
problem in implementing it in Erlang, because RFC2916 has examples containing 
^+. On the last IETF there were a bit of talk about this. As far as I have 
heard, ^+ is not invalid but it is very implementation dependent how well it 
works. In Erlang, that is not very well :(

>From RFC2916 :

   3.2.3 Example 3

        $ORIGIN 6.4.e164.arpa.
           * IN NAPTR 100 10 "u" "ldap+E2U" "!^+46(.*)$!ldap://ldap.se/cn=01!"
   .

Tests :

1> regexp:match("+461234", "+46(.*)$").
{error,{illegal,"+"}}
2> regexp:match("+461234", "\\+46(.*)$").
{match,1,7}
3> regexp:match("+461234", "^+46(.*)$").

On the third one, Erlang (R9C-0) regexp implementation loops.
regexp.erl was too complex for me to fix this myself, so I though I'd
raise the issue on the list so that someone else might perhaps at
least prevent the loop.

/Fredrik




More information about the erlang-questions mailing list