c# - Need Regex pattern to validate password pattern -


we need validate password against following pattern. “xabcdef99*” [1st char uppercase, 2nd 7th chars lowercase, 8th 9th digits , last char symbol ]

can provide me regex same? how can validate following password against regex in c#.

userpcs12* --> valid

testeur333 --> invalid (because last char not symbol)

userpcs12* --> invalid (because first char not uppercase)

you may try this,

^[a-z][a-z]{6}\d{2}[~!@#$%^&*]$ 

add symbols want inside last character class.

or

^[a-z][a-z]{6}\d{2}\w$ 

\w matches non-word character. change [\w_] if treat _ special charcater.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -