-
Notifications
You must be signed in to change notification settings - Fork 105
Description
Sorry for wasting your time and mine. I didn't read the code, and thought you don't have this.
Also misunderstood how this works. - I thought it was an alternative to regex, now I understand that its a regex builder. (Is the reverse being considered?)
Looked at the tests and saw the capture syntax which is much better than mine (BeginCapture, EndCapture).
My original comment:
Matching syntax for getting lists of text
-
Saved groups: .MatchBy
-
Grouping: Non saving groups: .MatchFor .
-
Dependency: And. Or
-
.AllThat .FirstThat .LastThat .AnyThat
-
.Is .IsNot .IsLike (wildcard syntax) .HasFormat (String.Format() syntax)
-
.HasDate( DateFormat DateSeperator ) HasTime, HasDateAndTime
-
.Until (inclusive), Before (non inclusive until) , After (starts after the found text)
-
.HasUnicode .HasAscii .Has (calls delegate with params)
'''C#
[TestMethod]
public void TestingIfWeHaveAValidURL()
{
// Create an example of how to find the params in a RESTful url
var verbEx = new VerbalExpressions()
.MatchFor( name:"param code", () => {
.AnyThat( afterOccurence: 1) // all matches after 1st param found by next match
// this is the way to get parenthesis around a group of rules
.MatchFor( name: "param name", () => {
.After("?").Or.After(";")
MatchBy( name: "param name", () => {
.Anything.Before("=")
});
});
.And.MatchFor( name: "param val", ()=>{
.After( matchFor: "param name")
//.Maybe(Environment.Quotemark)
.MatchBy(name: "param val", ()=>{
.Until.
//Maybe(Environment.Quotemark)
.Then(";").Or.EndOfLine;
});
});// Create an example URL var testMe = "https://www.google.com?param1=val1;¶m2=val2"; var matches = verbEx.Match( testMe ); Assert.IsGreaterThan( matches.Count, 0, "The URL has no parameters"); Console.WriteLine("We have a correct URL "); }'''