Regular Expressions
Discuss and ask questions concerning the usage of Regular Expressions (REGEXes) in the .NET Framework.
ประกาศ
- Link
Regex Meets Linq
OmegaManMVP4 กุมภาพันธ์ 2552 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.
การกรองและการเรียงลำดับใช้ตัวเลือกเหล่านี้เพื่อจำกัดคำถามและรายการสนทนาให้แคบลง
- 542743

.Net Regex Resources Reference
OmegaManMVP19 มกราคม 2550 19:51 - 22448

.Net Regex Tool - Regex Pixie
Jon von GillernMVP23 สิงหาคม 2555 1:49 - 1421520

Password Strength Expression
LarryEis 9 กุมภาพันธ์ 2553 19:43 - 1017968

Regex Substraction of Character Set
xalnix 13 สิงหาคม 2552 20:34 - 016739

How to Ask A Regular Expression Question
OmegaManMVP7 มกราคม 2553 19:18 - 21975

REGEX How to return multiple named groups using multiple expressions
gregc66 28 ธันวาคม 2555 22:47 - 21470

Need some help figuring out my regex mystery.
JoetheWinDev 27 ธันวาคม 2555 7:40 - 21537

What does it take to do this really simple match?
eBob.com 25 ธันวาคม 2555 19:44 - 31460

difference of a{2} and a{2,}
Jakub Jareš 25 ธันวาคม 2555 8:50 - 31786

Regular Expression Matching and Parsing a string
Chirag Shah 21 ธันวาคม 2555 18:46 - 93144

regular expression for telecommunications Circuit ID please..
Prakash Athikesavan 30 กรกฎาคม 2555 17:34 - 61752

Whole word match when wildcard exist in search pattern
Mohammed Stephan 20 ธันวาคม 2555 9:01 - 31741

How can I decorate a field with RegularExpression attribute?
salam.p.v 19 ธันวาคม 2555 18:15 - 112654

I want a Regex for Decimal(10,4)
salam.p.v 19 ธันวาคม 2555 13:10 - 72326

VB 2008 Regex Parsing HTML With HTTPWebRequest Implementation...
TeachMe 12 ธันวาคม 2555 4:10 - 41732

.NET Framework Regular Expressions
Tokimes 17 ธันวาคม 2555 16:32 - 21567

Replace Question
eBob.com 15 ธันวาคม 2555 17:35 - 51798

get data from tag
chezhian_in05 10 ธันวาคม 2555 15:42 - 61865

Find in files: lines containing await but not ConfigureAwait(false)
Sylvain De 8 ธันวาคม 2555 12:25 - 12012

Prepending a base url to all image tags in HTML source?
RectangleEquals 8 ธันวาคม 2555 18:52 - 21701

find lines with both words
Serve Laurijssen 5 ธันวาคม 2555 7:22 - 31728

How to use culture invariant for Regular expression ?
Manjula.C 4 ธันวาคม 2555 13:06 - 31712

ValidationExpression for alpha-numeric values
yogi3188 26 พฤศจิกายน 2555 6:26 - 11375

Get everything after ;#
KonaCoffee 4 ธันวาคม 2555 17:25 - 61099

I've never been able to figure this REGEX problem out...Newbie!
Mr. Javaman II 29 พฤศจิกายน 2555 22:49