Click below for Step by Step and Interview Q & A (dotnetinter) wrote,
Click below for Step by Step and Interview Q & A

.NET interview questions: - What is time out support in regex (regular expression)?

Some of the regular expressions are very complex and they can take lot of time to evaluate.
For instance below is a simple regular expression.


If someone inputs a huge number as shown in the below code snippet. It will take more than a minute to resolve the expression leading to lot of load on the application. So we would like to give a time out on the expression. So if the validation takes more than a specific interval we would like the application to give up and move ahead.


In .NET 4.5 we can now provide the timeout value as parameter on the constructor. For instance in the below code we have provided 2 seconds timeout on the regex (regular expression). So if it exceeds more than 2 second “regexMatchTimeOutException” will occur.


Also see following .NET interview questions video on regular expressions & can we see some practical demonstrations: -

Tags: .net, .net interview questions, c#, csharp interview questions, it interview questions, programming interview questions, regex, regular expression

  • How to create an OLAP Cube?

    This article will have no theory rather than it will have only be demonstrating practical step by step in detail included to create SSAS OLAP Cube:…

  • Instrumentation is SSIS using Data Taps

    In this short article we will hover around some important questions related to Instrumentation done in SSIS using Data Taps. We will only discuss…

  • Create job using SQL Server Agent step by step.

    In MSBI while working on SSIS projects we have to run repetitive task which has to carried out daily like running package or to take weekly backup…

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded