Skip to content

Commit

Permalink
Merge pull request #38 from IgniteUI/dgdimitrov/phone-numbers-regex
Browse files Browse the repository at this point in the history
fix(*): phone numbers regex fix
  • Loading branch information
hanastasov authored Oct 23, 2024
2 parents 623d7d0 + 1c6e9df commit 2bbeab6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion NorthwindCRUD/Models/Dtos/AddressDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class AddressDto : IAddress
[StringLength(50, ErrorMessage = "Country cannot exceed 50 characters.")]
public string Country { get; set; }

[RegularExpression(@"^\+?[1-9]\d{1,14}$", ErrorMessage = "Phone number is not valid.")]
[RegularExpression(@"^\+?\(?\d{1,5}\)?[-.\s]?\(?\d{1,5}\)?[-.\s]?\d{1,4}[-.\s]?\d{1,4}[-.\s]?\d{1,10}$", ErrorMessage = "Phone number is not valid.")]
public string? Phone { get; set; }
}
}
2 changes: 1 addition & 1 deletion NorthwindCRUD/Models/Dtos/ShipperDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class ShipperDto : IShipper
[StringLength(100, ErrorMessage = "Company Name cannot exceed 100 characters.")]
public string CompanyName { get; set; }

[RegularExpression(@"^\+?[1-9]\d{1,14}$", ErrorMessage = "Phone number is not valid.")]
[RegularExpression(@"^\+?\(?\d{1,5}\)?[-.\s]?\(?\d{1,5}\)?[-.\s]?\d{1,4}[-.\s]?\d{1,4}[-.\s]?\d{1,10}$", ErrorMessage = "Phone number is not valid.")]
public string Phone { get; set; }
}
}
4 changes: 2 additions & 2 deletions NorthwindCRUD/Models/Dtos/SupplierDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ public class SupplierDto : ISupplier
[StringLength(50, ErrorMessage = "Country cannot exceed 50 characters.")]
public string? Country { get; set; }

[RegularExpression(@"^\+?[1-9]\d{1,14}$", ErrorMessage = "Phone number is not valid.")]
[RegularExpression(@"^\+?\(?\d{1,5}\)?[-.\s]?\(?\d{1,5}\)?[-.\s]?\d{1,4}[-.\s]?\d{1,4}[-.\s]?\d{1,10}$", ErrorMessage = "Phone number is not valid.")]
public string? Phone { get; set; }

[RegularExpression(@"^\+?[1-9]\d{1,14}$", ErrorMessage = "Fax number is not valid.")]
[RegularExpression(@"^\+?\(?\d{1,5}\)?[-.\s]?\(?\d{1,5}\)?[-.\s]?\d{1,4}[-.\s]?\d{1,4}[-.\s]?\d{1,10}$", ErrorMessage = "Fax number is not valid.")]
public string? Fax { get; set; }

[RegularExpression(@"^https?:\/\/[^\s$.?#].[^\s]*$", ErrorMessage = "Home Page URL is not valid.")]
Expand Down

0 comments on commit 2bbeab6

Please sign in to comment.