Allow the + character in phone numbers. In the same time, fix a bug where other non...
[zxing.git] / zxing.appspot.com / generator / src / com / google / zxing / web / generator / client / Validators.java
index 51646bf..99458e4 100644 (file)
@@ -24,11 +24,11 @@ package com.google.zxing.web.generator.client;
  */
 public final class Validators {
   public static String filterNumber(String number) {
-    return number.replaceAll("[ +\\.,\\-\\(\\)]", "");
+    return number.replaceAll("[ \\.,\\-\\(\\)]", "");
   }
   
   public static void validateNumber(String number) throws GeneratorException {    
-    if (!number.matches("[0-9]+")) {
+    if (!number.matches("\\+?[0-9]+")) {
       throw new GeneratorException("Phone number must be digits only.");
     }
   }