Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a37fc575 authored by Bin Zhu's avatar Bin Zhu Committed by Johan Redestig
Browse files

Allow three digit phone numbers

The comment for the PHONE pattern says:

"<digit><digit|sdd>+<digit>"

But the actual pattern requires that the string contains
more than that. A phone number should be allowed to be
three digits.

Change-Id: I86d2f3d634cd0c1654dad9814906f151055dc23a
parent c5748148
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -172,7 +172,7 @@ public class Patterns {
        = Pattern.compile(                      // sdd = space, dot, or dash
                "(\\+[0-9]+[\\- \\.]*)?"        // +<digits><sdd>*
                + "(\\([0-9]+\\)[\\- \\.]*)?"   // (<digits>)<sdd>*
                + "([0-9][0-9\\- \\.][0-9\\- \\.]+[0-9])"); // <digit><digit|sdd>+<digit> 
                + "([0-9][0-9\\- \\.]+[0-9])"); // <digit><digit|sdd>+<digit>

    /**
     *  Convenience method to take all of the non-null matching groups in a
+2 −0
Original line number Diff line number Diff line
@@ -156,6 +156,8 @@ public class PatternsTest extends TestCase {
                "Me: 16505551212 this\n",
                "Me: 6505551212 this\n",
                "Me: 5551212 this\n",
                "Me: 2211 this\n",
                "Me: 112 this\n",

                "Me: 1-650-555-1212 this\n",
                "Me: (650) 555-1212 this\n",