Click here to Skip to main content
15,868,074 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
if i tell a user to enter 4563217876 then only it will proceed if not matched it will return to normal. i am creating it in visualC#
can anyone help in this regard??

What I have tried:

i have tried using regex command but it takes any number but i want the program to accept only one code. for eg 5436789543
Posted
Updated 25-Feb-18 21:44pm
Comments
Suvendu Shekhar Giri 26-Feb-18 3:12am    
Share the code you have tried.

1 solution

Regexes are text matching programs, and are not ideal for exact matches, although yopu can do it. For example, the following Regex will only match your example:
^4563217876$

But ... in C#, it's easier than that, you don't need a Regex at all:
C#
public bool DoesThisMatch(string input)
   {
   return input == "4563217876";
   }
 
Share this answer
 

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