Regular Expressions
Discuss and ask questions concerning the usage of Regular Expressions (REGEXes) in the .NET Framework.
Pemberitahuan
- Link
Regex Meets Linq
OmegaManMVP04 Februari 2009 17:16If 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.
Menyaring dan MengurutkanGunakan pilihan ini untuk mempersempit pertanyaan dan daftar diskusi.
- 542732

.Net Regex Resources Reference
OmegaManMVP19 Januari 2007 19:51 - 22443

.Net Regex Tool - Regex Pixie
Jon von GillernMVP23 Agustus 2012 1:49 - 1421512

Password Strength Expression
LarryEis 09 Februari 2010 19:43 - 1017964

Regex Substraction of Character Set
xalnix 13 Agustus 2009 20:34 - 016731

How to Ask A Regular Expression Question
OmegaManMVP07 Januari 2010 19:18 - 21968

REGEX How to return multiple named groups using multiple expressions
gregc66 28 Desember 2012 22:47 - 21469

Need some help figuring out my regex mystery.
JoetheWinDev 27 Desember 2012 7:40 - 21534

What does it take to do this really simple match?
eBob.com 25 Desember 2012 19:44 - 31457

difference of a{2} and a{2,}
Jakub Jareš 25 Desember 2012 8:50 - 31781

Regular Expression Matching and Parsing a string
Chirag Shah 21 Desember 2012 18:46 - 93139

regular expression for telecommunications Circuit ID please..
Prakash Athikesavan 30 Juli 2012 17:34 - 61751

Whole word match when wildcard exist in search pattern
Mohammed Stephan 20 Desember 2012 9:01 - 31735

How can I decorate a field with RegularExpression attribute?
salam.p.v 19 Desember 2012 18:15 - 112629

I want a Regex for Decimal(10,4)
salam.p.v 19 Desember 2012 13:10 - 72323

VB 2008 Regex Parsing HTML With HTTPWebRequest Implementation...
TeachMe 12 Desember 2012 4:10 - 41728

.NET Framework Regular Expressions
Tokimes 17 Desember 2012 16:32 - 21562

Replace Question
eBob.com 15 Desember 2012 17:35 - 51795

get data from tag
chezhian_in05 10 Desember 2012 15:42 - 61862

Find in files: lines containing await but not ConfigureAwait(false)
Sylvain De 08 Desember 2012 12:25 - 12010

Prepending a base url to all image tags in HTML source?
RectangleEquals 08 Desember 2012 18:52 - 21699

find lines with both words
Serve Laurijssen 05 Desember 2012 7:22 - 31726

How to use culture invariant for Regular expression ?
Manjula.C 04 Desember 2012 13:06 - 31701

ValidationExpression for alpha-numeric values
yogi3188 26 Nopember 2012 6:26 - 11373

Get everything after ;#
KonaCoffee 04 Desember 2012 17:25 - 61096

I've never been able to figure this REGEX problem out...Newbie!
Mr. Javaman II 29 Nopember 2012 22:49