Dead-easy regular expression matching for C#
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Properties
.gitignore
LineMatches.cs
LineMatchesTests.cs
README.rst
Runter.cs
RunterTests.cs
TheLimberLambda.Util.csproj
TheLimberLambda.Util.sln
packages.config

README.rst

(R)regular Expression H(unt)

Dead-easy regular expression matching in C#:

csharp> using TheLimberLambda.Util;
csharp> "The quick, brown fox ...".Runt(@"\w+");
{ "The", "quick", "brown", "fox" }

Return matches within enumerables of String and include the 1-based line number:

csharp> using TheLimberLambda.Util;
csharp> // 1-based line number
      > new[] {
      > @"Looking for a ",
      > @"G]Z('*br8<[~vo3I`W{T",
      > @"#U'Deb?7D^3O&~93ni>y",
      > @"{VAfo8yo9/Fqs7#ezpVK",
      > @"gneedleiinQm}W4l4%7|",
      > @">=?a&*p~r!?vv'[bDjmd",
      > @"58~D*S0P)i-._o|u)U?e",
      > @"WR`AjezlL*5VGS`Wt<'x",
      > @"W%!%re2BNN4w7fAt\H$5",
      > @"!?fjm!ET;X)nbfRd)*7'",
      > @"7*[vF!fzN:kk_7wLMSI4",
      > @"a haystack" }.
      > Runt(@"(?:nee\w+e|in(?![a-z]))");
{ 5: needle, in }

Search in text files, and return the line number:

csharp> using TheLimberLambda.Util;
csharp> using System.IO;
csharp>
csharp> File.WriteAllText("/tmp/julius.txt",
      > @"veni
      > vidi
      > vici
      > ");
csharp> new FileInfo("/tmp/julius.txt").Runt("i[a-z]i");
{ 2: idi, 3: ici }