.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

How to match regular expression in c# with two grouped expressions

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :WPF
I would like to match a string separated by "/" followed by an expression like 1..100 and again string separated by "/" followed by 1..100, here is the string format.
here is my regular expression 
Regex regAppDH = new Regex(@"/String1/String2/String3/stirng4(\[[0-9]|[1-9][0-9]\])/string5/stirng6\[[0-9]|[1-9][0-9]\]")
This regular expression does not match after the first group expression ( before string5)  , can any body help to get this expression working.
stirng1,string2,string3,string4 and string5,string6 are alpha numeric and fixed. 


View Complete Post

More Related Resource Links

Regular Expression to Match


Here is the kind of text I want to match via a regular Expression

The id="dgSchedule" is always present in the TAG but its location may differ

The table is span over multiple line/contains white spaces/tabs...

I have the regular expression to match the start and end tag respectively over a single line

\<table .*\>


The problem is to match the whole table span over multiple lines

<table cellspacing="0" rules="all" border="1" id="dgSchedule" style="border-style:None;height:100%;width:100%;border-collapse:collapse;">
	<tr class="blackbar" align="center" style="background-color:#7FB4DE;font-family:Verdana;font-weight:bold;height:20px;">
		<td>From Place</td><td>To Place</td><td>Time</td><td>Bus Type</td>

	</tr><tr style="background-color:#DEECF5;">
	</tr><tr style="background-color:#EFF5FA;">
	</tr><tr style="background-color:#DEECF5;">


Regular Expression to match "="(45167)" and retrieve only the code inside parentheses



Need a Regular Expression to match "=&quot;(45167)" and retrieve only the code inside  parentheses say 45167

thanks in advance

Regular expression to match for -


I need my string to be a minimum of 8 character, begin with 3 alphanumber,  end in alphanumberic and contain atleast one -

Below is what I have that includes everything but testing for inlcusion of atleast one -


string example to work with...

abc-1234,  123-adjoq-jadfoqe, 123abc-a

Strings that should fail...

as-jdsdjf, a-a-dfa, acb-3gh, abc-1234-


Have match AD path Regular Expressions?

Have match AD path Regular Expressions?

Problem Excluding Section In Quotes From Regular Expression Match


Hi There,

Currently I have the string:

"WHERE Column_1_Name = 1 AND Column_2_Name = 'Test Column Criteria'"

& my desired matches are as follows:




However, so far, I can only achieve

'Test Column Criteria'

via: (([a-z][\w]+)|('[\w ]+'))(?!('[\w ]+'))




via (('[\w ]+')|([a-z][\w]+))(?<=\3)


All help appreciated much appreciated.

(I'm using the .net engine, case insensitive)

Regular Expression Match Exact String


I'm looking for a regular expression that satisfies one of the two conditions (Reg Expression OR Exact String Match W/ Underscores) listed below.





Thanks in advance

Can we use regular expression to match numbers not preceded by a specified set of characters


I have been trying to come up with a RegEx that would match numbers (including decimals and negative numbers) that are not preceded by a specified set of characters. For example:

Specified set of characters (not including comma): c, t

Input string: “This c2 is one element. And t-4a, d25, c2.54, v4.28, q58 are other elements”

Desired result (the numbers not preceded by c and t):

The pattern I tried: [^ct](-?\d+\.?\d*|\.\d+)

The matches I got (Note: I fetched the results from Group 1):


I don’t want the numbers in bold to be returned since in t-4a the integer -4 is preceded by t, and in c2.54, 2.54 is preceded by c.

Can we refine the above pattern or is it even possible?

Thank you.

Security Briefs: Regular Expression Denial of Service Attacks and Defenses


Microsoft security expert Bryan Sullivan believes denial-of-service blackmail attacks will become more common as privilege escalation attacks become more difficult to execute. He demonstrates how to protect your apps against regular expression DoS threats.

Bryan Sullivan

MSDN Magazine May 2010

Toolbox: Online Scheduling, Jeff Smith's SQL Blog, Easy Regular Expressions, And More


This month Scott looks at improving development skills, writing regular expressions, a web scheduling control and a SQL tips blog.

Scott Mitchell

MSDN Magazine November 2008

SQL Server 2005: Regular Expressions Make Pattern Matching And Data Extraction Easier


Now you can perform efficient, sophisticated text analysis using regular expressions in SQL Server 2005.

David Banister

MSDN Magazine February 2007

Toolbox: Rich Web App UIs, Tools for Regular Expressions, and More


In this issue, create rich Web app UIs, explore tools for regular expressions, and create screen mockups.

Scott Mitchell

MSDN Magazine February 2007

Netting C++: Introducing Regular Expressions


This month Stanley Lippman introduces the support for regular expressions in the .NET Framework.

Stanley B. Lippman

MSDN Magazine November 2006

C++ at Work: Form Validation with Regular Expressions in MFC


I thought I'd use this month's column to describe an interesting app I built using the RegexWrap library described in my article "Wrappers: Use Our ManWrap Library to Get the Best of . NET in Native C++ Code" in this issue.

Paul DiLascia

MSDN Magazine April 2005

Help with regular expression


I am using this regular expression: /.*-lyrics-.*$

and I need the expression find urls like this:

and it do really does that!

The problem is that it finds also this URL:

Whar regular expression should I use to exclude urls that end with /lyrics ?

Thanks :]



Need a regular expression


I have a required field validator for a texbox, but I just found out that the texbox can have a space in it (for a delimiter, let's say).

I checked the .net and regexlib.com, but couldn't find what I was looking for.

I simply need a regular expression that basically excepts any character string including spaces in it or even a space by itself

Can someone help me out?

Regular Expressions in Filterd Textbox Extender.

Hi... Can we use Regular Expression in Filterd Textbox Extender to match Valid or invalid char. If yes how? Please give me a simplle example... Thank you?

regular expression

hi...can anobody help me that how to write regular expression for textbox..such as the textbox should accept only numbers otherwise alert msg should be displayed ..displaying that u cannot enter the charcter in the textbox..i want this in javascritp.. 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend