.Net Interview Questions and Answers

Search:

What is Regular expression? (DotNet and C# Interview questions)

By : Shiv Prasad Koirala | Dec 6th, 2014 | Views : 4431 | Comments : 0 Bookmark and Share

Regular expression is a pattern matching technique. Most of the data follow patterns, some examples of common data patterns are as shown in the below table :-


Email Address

xyz@pqr.com
abc@lmn.com

Email address data starts with some characters followed by "@" and then a "." and finally the domain extension.

Phone number

901-9090-909023
909-999-1202920

Phone number data starts with an international code followed by region code and then the phone number.


By using regular expression you can represent these data patterns and utilize the same for validations and manipulation of data.


In order to use regular expression we need to create the object of "Regex" class and pass the pattern to Regex. For example the below pattern represent's data pattern of 10 character length which can be any small characters from a to z.



Once you have specified the pattern as described in the previous step you can then use the "IsMatch" function to check if the data matches with the pattern.



Note: - In some rare cases we have seen interviewers ask to write down regex patterns. So we would suggest to see the below youtube video "Explain Regex ?" which explains how to write any complex regular expression with ease.



Preparing for .NET and C# interview visit us at www.questpond.com

 
Rate this Article :
1 Star
2 Stars
3 Stars
4 Stars
5 Stars
1 1 1 2 1
 
 
 
 

.NET interview questions 6th edition (Sixth edition) - By Shivprasad Koirala

In this article we will explain .NET interview questions 6th edition (Sixth edition) - By Shivprasad Koirala.... Read More

What is the difference between Stored Procedures and Function (SQL Server interview question with answers)?

In this article we will explain what is the difference between Stored Procedures and Function.For more articles and videos visit us on www.questpond.com... Read More

Explain MVC application life cycle?

In this article we will explain MVC application life cycle.For more articles and videos visit us on www.questpond.com... Read More

C# Design pattern interview questions with answers: - How Singleton is different from Static class?

In this article we will explain How Singleton is different from Static class.... Read More

WCF interview questions and answers: - What is the difference between Service endpoint and Client endpoint?

In this article we will explain What is the difference between Service endpoint and Client endpoint.... Read More

.NET interview questions 6th edition (Sixth edition) - By Shivprasad Koirala

In this article we will explain .NET interview questions 6th edition (Sixth edition) - By Shivprasad Koirala.... Read More

What is the difference between Stored Procedures and Function (SQL Server interview question with answers)?

In this article we will explain what is the difference between Stored Procedures and Function.For more articles and videos visit us on www.questpond.com... Read More

Explain MVC application life cycle?

In this article we will explain MVC application life cycle.For more articles and videos visit us on www.questpond.com... Read More

C# Design pattern interview questions with answers: - How Singleton is different from Static class?

In this article we will explain How Singleton is different from Static class.... Read More

WCF interview questions and answers: - What is the difference between Service endpoint and Client endpoint?

In this article we will explain What is the difference between Service endpoint and Client endpoint.... Read More

Article Categories

Learn in Hindi