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 |
What do you mean by serialize and marshalbyref?
Which method do you invoke on the DataAdapter control to load your generated dataset with data?
What will happen if the server confugration file and the application confugration file have different values for sassion state ASP.NET?
To which class you load XML or Related Data
Hi, I am a fresher. i have a problem related to DataGrid . i have a data grid and i have to place a dropdown in the datagrid.and i have to retrieve the values from the database (sqlserver).please tell me any idea about the code.
What are ASP.NET Web Forms? How is this technology different than what is available though ASP?
Can we have multiple master pages in asp net?
How will you do Redo and Undo in a TextControl?
What are the elements of a website?
What is _dopostback in asp net?
Explain login control and form authentication.
For Web services where you can browse on the Internet?