-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Tim Bourguignon edited this page Mar 11, 2014
·
66 revisions
A SimpleExpression object is mostly used to create a regular expression. Nevertheless it also wraps a Regex object and can thus provide basic matching and validation functions.
A SimpleExpressions is build by chaining commands one after the other, each consecutive members separated by a dot .. Two Content members chained one after the other imply "the first one - then - the second one":
Text("http").Text("://") //means that we want to match "http://"
Text("http").Maybe("s").Text("://") //means we want to match "http://" and "https://"
Here are all the functions that SimpleExpressions currently supports:
Content
Alphanumerics,Letters,NumbersOne(char/string),OneOf(string)Text(string)Maybe(string)EitherOf(string)
Modifiers
Logical operators
Groups and bounds
- Repetition
Exactly(int)/AtLeast(int).AtMost(int) - Groups
Group.X.Y.Together.As(string)
Potential Roadmap (!Here be Dragons!)
- PreRepeaters
OneOrMore,ZeroOrMore - Use
Maybeto notify that the next element is optional - Use
Either-Or-Thenstructure instead of justOr-Then(to limit the number of groups that must be created) - Implement something like a
Repeat-X-Cardinal-Times? AnythingWord(string)StartsWithEndOfLine