Reputation: 949
I only wanna see few characters in my website in the filed section.
My regex code in the backend is: [(validator.field) = {regex: "^([0-9][+:\\-\\;]?)+"}];
and it's not working. Any help
So the user should only insert numeric (0-9), ; (semicolon) and : (colon).
Upvotes: 1
Views: 53
Reputation: 1227
If user can put (;
and :)
in between numbers, you can use [\d;:]+$
.
However, if you need to match digits first and :
or ;
after them, use ^\d+[;:]+$
.
Upvotes: 1