i am trying to create a pattern that accept everything without word characters (a-z or A-Z) in angular.
phone: new FormControl(null, [
Validators.required,
Validators.pattern("^-?[0-9]\\d*(\\.\\d{1,2})?$"),
]),
i try this patter but not work fine because my goal is:
pattern must accept :
()*#%&#@64582 (example 1)
3796592#$#@$%^&$&/ (exapmle 2)
34242+5334?@^#$#%4242 (example 3)
That mean everything without (a-z or A-Z)
Pattern must not accept :
$%$@#423URVB
t3653$^%#&#%&
Any idea ?
Your suggested pattern allows positive or negative floats and is not relevant to your wishes
Normally we use a negated class
/^[^a-zA-Z]$/g
but that will allow öää for example
/^[^a-zA-Z\p{L}]$/gu
will also block unicode characters but allow special characters
https://regex101.com/r/WxARn2/1
I can however not find how to add the flag to Angular PatternValidator so you will need to test it