Skip to content

Commit 551ee27

Browse files
improve phone pattern to support dashes and phones starting with zero
1 parent 2b880ac commit 551ee27

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

NorthwindCRUD/Models/Dtos/AddressDto.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class AddressDto : IAddress
2020
[StringLength(50, ErrorMessage = "Country cannot exceed 50 characters.")]
2121
public string? Country { get; set; }
2222

23-
[RegularExpression(@"^\+?[1-9]\d{1,14}$", ErrorMessage = "Phone number is not valid.")]
23+
[RegularExpression(@"^\+?[0-9][0-9\-]{1,14}$", ErrorMessage = "Phone number is not valid.")]
2424
public string? Phone { get; set; }
2525
}
2626
}

0 commit comments

Comments
 (0)