Click here to Skip to main content
15,613,716 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
i want to validate cc,bcc for sending email(mails seperated by ,).presently i am using the below code to validate

<stringlengthvalidator(0,2000)> _
        <validatorcomposition(microsoft.practices.enterpriselibrary.validation.compositiontype.or)> _
        <regexvalidator("^(\s*,?\s*[0-9a-za-z]([-.\w]*[0-9a-za-z])*@([0-9a-za-z][-\w]*[0-9a-za-z]\.)+[a-za-z]{2,9})+\s*$",MessageTemplate:="EmailObject_009")> _
        Public Property MailBCC() As String

Here it is not working if i keep only 0 and remove 2000 then it is working fine .but i want to check upper boundaryrange also ...

how should i do this...
Updated 31-Oct-13 23:23pm

1 solution

Try this site.

Regex Tester[^]

Your regular expression:

Your test string:

If the Entered mail ID or contect is not matching then shows ["No Match Found"], so we have to change the expression to validate as per our requirement.

If the pattern & Entereted content matches, then it will display all possible values that can accept.
Share this answer
pullareddy S 1-Nov-13 5:23am    
Thanks for your reply.
in my requirement regular expression is working fine for (,)seperated emails..
but in first line i wrote <stringlengthvalidator(0,2000)> _
in second line i wrote (or condition)
in 3rd line i wrote regularexpression validator
here Expression is fine but when there is some text like "aaaaa" it should validate there.
but because of (or condition), the text is in between 0-2000 is even next it is not validating expression....
For me in cc even the text is nothing.
but if the text is there in cc .it should check Expression..How to do this please...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900