Regular Expressions
Discuss and ask questions concerning the usage of Regular Expressions (REGEXes) in the .NET Framework.
Announcements
- Link
Regex Meets Linq
OmegaManMVPWednesday, February 04, 2009 5:16 PMIf you love Regex...then Regex and Linq is a match made in Heaven. Here are two scenarios where Regex and linq can be used together.- Place Key Value Pairs into a dictionary<string,string> object from regex: Regex To Linq to Dictionary in C#
Here is a quick example where this input "123abcd3" will tokenized into digits or characters and placed into an IEnumerable array with values of "123", "abcd" and "3".
The tokenization will occur and the named match Tokens will contain sub captures. Those captures will be enumerated and placed into an IEnumerable <string> array.string input = "123abcd3"; string pattern = @"(?<Tokens>\d+|[a-zA-Z]+)+"; var items = from Match m in Regex.Matches( input, pattern ) from Capture cpt in m.Groups["Tokens"].Captures select cpt.Value; Console.WriteLine( string.Join( ",", items.ToArray() ) ); // Outputs // 123,abcd,3
This should get you started in using Linq with Regex. GL HTH
- Link
This Forum Has Been Retired
This forum is locked; it is still available for review in the Archived Forums folder. Any future posts on this topic should be put in the .NET Framework Class Libraries forum.
Filtering and SortingUse these options to narrow down the question and discussion list.
- 542765

.Net Regex Resources Reference
OmegaManMVPFriday, January 19, 2007 7:51 PM - 22457

.Net Regex Tool - Regex Pixie
Jon von GillernMVPThursday, August 23, 2012 1:49 AM - 1421549

Password Strength Expression
LarryEis Tuesday, February 09, 2010 7:43 PM - 1017990

Regex Substraction of Character Set
xalnix Thursday, August 13, 2009 8:34 PM - 016751

How to Ask A Regular Expression Question
OmegaManMVPThursday, January 07, 2010 7:18 PM - 21995

REGEX How to return multiple named groups using multiple expressions
gregc66 Friday, December 28, 2012 10:47 PM - 21483

Need some help figuring out my regex mystery.
JoetheWinDev Thursday, December 27, 2012 7:40 AM - 21551

What does it take to do this really simple match?
eBob.com Tuesday, December 25, 2012 7:44 PM - 31471

difference of a{2} and a{2,}
Jakub Jareš Tuesday, December 25, 2012 8:50 AM - 31804

Regular Expression Matching and Parsing a string
Chirag Shah Friday, December 21, 2012 6:46 PM - 93156

regular expression for telecommunications Circuit ID please..
Prakash Athikesavan Monday, July 30, 2012 5:34 PM - 61768

Whole word match when wildcard exist in search pattern
Mohammed Stephan Thursday, December 20, 2012 9:01 AM - 31753

How can I decorate a field with RegularExpression attribute?
salam.p.v Wednesday, December 19, 2012 6:15 PM - 112756

I want a Regex for Decimal(10,4)
salam.p.v Wednesday, December 19, 2012 1:10 PM - 72345

VB 2008 Regex Parsing HTML With HTTPWebRequest Implementation...
TeachMe Wednesday, December 12, 2012 4:10 AM - 41746

.NET Framework Regular Expressions
Tokimes Monday, December 17, 2012 4:32 PM - 21573

Replace Question
eBob.com Saturday, December 15, 2012 5:35 PM - 51807

get data from tag
chezhian_in05 Monday, December 10, 2012 3:42 PM - 61883

Find in files: lines containing await but not ConfigureAwait(false)
Sylvain De Saturday, December 08, 2012 12:25 PM - 12027

Prepending a base url to all image tags in HTML source?
RectangleEquals Saturday, December 08, 2012 6:52 PM - 21713

find lines with both words
Serve Laurijssen Wednesday, December 05, 2012 7:22 AM - 31733

How to use culture invariant for Regular expression ?
Manjula.C Tuesday, December 04, 2012 1:06 PM - 31732

ValidationExpression for alpha-numeric values
yogi3188 Monday, November 26, 2012 6:26 AM - 11387

Get everything after ;#
KonaCoffee Tuesday, December 04, 2012 5:25 PM - 61103

I've never been able to figure this REGEX problem out...Newbie!
Mr. Javaman II Thursday, November 29, 2012 10:49 PM

