Link to home
Start Free TrialLog in
Avatar of Jacque Scott
Jacque ScottFlag for United States of America

asked on

Understanding a RegEx for C#

I have this string and I am not understanding the whole thing.  Can someone please help me out?

if(Regex.IsMatch(fileNumberString,"^[0-9]{5}[A-Za-z0-9]*$")==false)

The portion I am having a problem with is "^[0-9]{5}[A-Za-z0-9]*$"

 [0-9]        I am assuming this is looking for a number
{5}             I don't know what this is for
[A-Za-z0-9]       I am assuming this is looking for upper or lower case letters and adding the 0-9 means it can be a combination of letters and numbers.
*$               I don't know what this is for except to end the regex.


I want to add a condition.  I need to look for a '.'  I believe I need to escape this '/.' but I don't know where to add it.

Thanks in advance.
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jacque Scott

ASKER

Thank you for all the information.  I added /. so I can match those strings with a '.'.