the expression is used to validate userinput from a textfield in a asp.net website
it should validate a username: roules for the username is that starts with pc or lc, and afterthat its 4 to 8 numbers like:
pc12345678 or lc12345678
can any of you create a regular expression for me? :)
VulpesPosted Sep 23, 2013, 8:24 AM
string regExp = @"^(p|l)c\d{4,8}$";
or, if upper case as well as lower case letters are allowed:
string regExp = @"^(?i)(p|l)c\d{4,8}$";
jesperPosted Sep 24, 2013, 6:27 AM
Puneet GuptaPosted Sep 23, 2013, 9:08 AM
Jignesh TrivediPosted Sep 23, 2013, 8:55 AM
hi,
I have one question case of pc or lc is matter?
if yes then agree with Vulpe..
other wise try
^(p|l|P|L)(c|C)\d{4,8}$
hope this will help you.
Sanjeeb LenkaPosted Sep 23, 2013, 7:51 AM
try this. any problem reply
^(lc|pc|PC|LC)\d{4,8}$
Sanjay KumarPosted Sep 23, 2013, 7:22 AM
try this
http://stackoverflow.com/questions/576196/regular-expression-allow-letters-numbers-and-spaces-with-at-least-one-letter
http://stackoverflow.com/questions/1649435/regular-expression-to-limit-number-of-characters-to-10