Skip to content

Commit

Permalink
Fix phone number constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
yuxunn committed Nov 7, 2023
1 parent 873cbe5 commit 4c68354
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/main/java/seedu/address/model/person/Phone.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class Phone {
public static final String MESSAGE_CONSTRAINTS =
"Phone number should only contain numbers. Phone number should be at least 3 digits long "
+ "and should not be longer than 8 digits.";
public static final String VALIDATION_REGEX = "\\d{3,}";
public static final String VALIDATION_REGEX = "\\d{3,8}";
public final String value;

/**
Expand All @@ -31,11 +31,8 @@ public Phone(String phone) {
* Returns true if a given string is a valid phone number.
*/
public static boolean isValidPhone(String test) {
return test.matches(VALIDATION_REGEX) && (test.length() >= 3 && test.length() <= 8);
return test.matches(VALIDATION_REGEX);
}



@Override
public String toString() {
return value;
Expand Down

0 comments on commit 4c68354

Please sign in to comment.