From the given paragraph of text, write a program to match
the strings of format “Any number of numerals followed by
an underscore followed by any number of alphabets"
ex:123_abc
(Note:using regular expressions)
Answers were Sorted based on User's Feedback
Answer / kp
private void RegExp(string input)
{
string s = input;
Regex regexp = new Regex("^[0-9]*_[A-Za-z]*$");
if(regexp.IsMatch(input))
Console.WriteLine("Matched");
else
Console.WriteLine("Not Match");
}
Is This Answer Correct ? | 19 Yes | 2 No |
Answer / raghuram
both the above answers are wrong....... Reg Exp should say..
new Regex("[0-9]*_[A-Za-z]*");
^ and $ mean beginning and end of a line... and the question
is to select that particular combination no matter where
they are present...... need not be entire line.
Is This Answer Correct ? | 5 Yes | 0 No |
Answer / thanvir
private void RegExp(string input)
{
string s = input;
Regex regexp = new Regex("^[0-9]*_[A-Za-z]*$");
if(regexp.IsMatch(input))
Console.WriteLine("Matched");
else
Console.WriteLine("Not Match");
}
Is This Answer Correct ? | 3 Yes | 2 No |
Answer / pio
Raghuram is right and his regex is 100% correct. The other
2 answers also have a string which does nothing:
string s = input;
so it is not necessary.
Is This Answer Correct ? | 1 Yes | 1 No |
Where can I get information on cookies in asp.net?
how to add cliet side event to server side? and how to register client script to sever side? wt difference these two
what is session . how it is use ?
Define xmlvalidatingreader class.
What is dataset and uses of dataset ?
Can we store object in viewstate?
How long the items in ViewState exists?
0 Answers SwanSoft Technologies,
What is the difference between exe and dll?
when user is logged on the information is saved in a cookie, what is the name of that cookie?
What is meant by asp.net?
Name and describe some HTTP Status Codes and what they express to the requesting client ?
Can the action attribute of a server-side tag be set to a value and if not how can you possibly pass data from a form page to a subsequent page?