Testing Regex for Alphanumeric Value validation

  • Thread starter Thread starter Abhijeet Khopade
  • Start date Start date
A

Abhijeet Khopade

Guest
Hi,

I am using regex validator in our code. This validator is working for some of the Regular Expressions like validating CC and Bank Account number. But method is not working to Validate Alphanumeric values like (D23145890 or XJ13256141).

My code is as below -

foreach (var regex in m_aRegexes)
{
Regex oRegex = (Regex) regex;

mc = oRegex.Matches(m_sTxt);

if(mc.Count > 0)

Return True;

Else

Return false;

}


Working Regex -

1) (^[a-z0-9][-a-z0-9._]+@([-a-z0-9]+\.)+[a-z]{2,5}$)

2) (\d{3}-\d{3}-\d{4}|^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$)


Non Working Regex -

1) (^(?!^0+$)[a-zA-Z0-9]{3,20}$)

2) (^E\d{6}?$)


Can somebody please help me here?



Abhijeet Khopade

Continue reading...
 
Back
Top