Click here to Skip to main content
15,886,806 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionXML tag & recordset not working in firefox Pin
Member 819658023-May-12 1:19
Member 819658023-May-12 1:19 
AnswerRe: XML tag & recordset not working in firefox Pin
jkirkerx23-May-12 9:16
professionaljkirkerx23-May-12 9:16 
QuestionCheck for repeated characters Pin
padmanabhan N22-May-12 22:10
padmanabhan N22-May-12 22:10 
AnswerRe: Check for repeated characters Pin
Not Active23-May-12 2:32
mentorNot Active23-May-12 2:32 
AnswerRe: Check for repeated characters Pin
jkirkerx23-May-12 13:01
professionaljkirkerx23-May-12 13:01 
GeneralRe: Check for repeated characters Pin
Not Active23-May-12 13:16
mentorNot Active23-May-12 13:16 
GeneralRe: Check for repeated characters Pin
jkirkerx24-May-12 5:10
professionaljkirkerx24-May-12 5:10 
AnswerRe: Check for repeated characters Pin
markovl23-May-12 21:07
markovl23-May-12 21:07 
Hi,

As Mark noted, it may be easiest to solve this by using Regular Expressions.
On the server side you should use the Regex class found in the System.Text.RegularExpressions namespace.

A simple pattern to match exactly two repeated hyphens looks like "-{2}". If you want to match 2 and more consecutive hyphens, the pattern may be modified to "-{2,}". Then you can use the IsMatch method from the Regex class to test a string (In your case the email) like this:
C#
Regex regex = new Regex("-{2}");
bool isValid = !regex.IsMatch(emailString);


On the client side is even easier. You can use the same pattern with the RegExp JavaScript object.
Then, call its test method. Something like this:

JavaScript
var regex = new RegExp('-{2}');
var isValid = !regex.test(emailString);

// Even easier way is to use the String.search method and the RegExp shorthand:
var isValid = emailString.search(/-{2}/) == -1;


I hope this is helpful Wink | ;)
2A


modified 24-May-12 4:48am.

QuestionScope For Hospital Management Pin
santosh_pathak22-May-12 21:51
santosh_pathak22-May-12 21:51 
AnswerRe: Scope For Hospital Management Pin
Sandeep Mewara22-May-12 23:44
mveSandeep Mewara22-May-12 23:44 
GeneralRe: Scope For Hospital Management Pin
santosh_pathak23-May-12 0:13
santosh_pathak23-May-12 0:13 
AnswerCross posted from design forum Pin
Pete O'Hanlon23-May-12 0:20
mvePete O'Hanlon23-May-12 0:20 
QuestionVSTO Pin
Ramkumar_S22-May-12 19:49
Ramkumar_S22-May-12 19:49 
AnswerRe: VSTO Pin
Not Active23-May-12 2:36
mentorNot Active23-May-12 2:36 
QuestionApproach on getting rid of server side validation Pin
Fabio Franco22-May-12 12:13
professionalFabio Franco22-May-12 12:13 
AnswerRe: Approach on getting rid of server side validation Pin
jkirkerx23-May-12 6:49
professionaljkirkerx23-May-12 6:49 
GeneralRe: Approach on getting rid of server side validation Pin
Fabio Franco23-May-12 7:23
professionalFabio Franco23-May-12 7:23 
GeneralRe: Approach on getting rid of server side validation Pin
jkirkerx23-May-12 10:04
professionaljkirkerx23-May-12 10:04 
GeneralRe: Approach on getting rid of server side validation Pin
Fabio Franco23-May-12 10:19
professionalFabio Franco23-May-12 10:19 
GeneralRe: Approach on getting rid of server side validation Pin
jkirkerx23-May-12 11:44
professionaljkirkerx23-May-12 11:44 
GeneralRe: Approach on getting rid of server side validation Pin
Fabio Franco23-May-12 16:14
professionalFabio Franco23-May-12 16:14 
GeneralRe: Approach on getting rid of server side validation Pin
jkirkerx24-May-12 5:37
professionaljkirkerx24-May-12 5:37 
GeneralRe: Approach on getting rid of server side validation Pin
Fabio Franco24-May-12 8:32
professionalFabio Franco24-May-12 8:32 
AnswerRe: Approach on getting rid of server side validation Pin
vvashishta25-May-12 2:41
vvashishta25-May-12 2:41 
QuestionJavascript and code-behind button events Pin
MattFFunke22-May-12 6:13
MattFFunke22-May-12 6:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.