I have regular expression which is checking for at least one character or number:
^(?=.*[a-zA-Z])(?=.*[0-9]).*$
I want to add one more condition there to 开发者_运维技巧exclude forward slash:
I know that to exclude forward slash would be something like that [^/] but i don't know how exactly put it to my regex.
May be someone may help me with that?
^(?=.*[a-zA-Z])(?=.*[0-9])[^/]*$
That's all there is to it.
The dot .
means "any character". The *
repeats the previous token 0 or more times. So
[^/]*
means "zero or more non-slash characters", whereas
[^/].*
means "one non-slash character, followed by zero or more characters of any kind".
精彩评论