-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Appends a literal string to the current pattern.
var pattern = Pattern
.With()
.Literal("Hello");Result: Hello
Returns a pattern that matches any digit character.
var pattern = Pattern
.With()
.Digit();Result: \d
Returns a pattern that matches any word character.
var pattern = Pattern
.With()
.Word();Result: \w
Returns a pattern that matches the pattern in the group.
var pattern = Pattern
.With()
.Group(g => g.Digit(Quantifier.Exactly(4)));Result: (\d{4})
Returns a pattern that matches the pattern in the named group.
var pattern = Pattern
.With()
.Group("Year", g => g.Digit(Quantifier.Exactly(4)));Result: (?<Year>\d{4})
Appends the "^" anchor to the current pattern to match the start of a line.
var pattern = Pattern
.With()
.StartOfLine();Result: ^
Appends the "$" anchor to the current pattern to match the end of a line.
var pattern = Pattern
.With()
.EndOfLine();Result: $
This function returns a pattern that matches the first, second, or any additional literal provided.
var pattern = Pattern
.With()
.OneOf("Hello", "World"));Result: (Hello|World)
var pattern = Pattern
.With()
.OneOf(Quantifier.OneOrMore, "Hello", "World"));Result: (Hello|World)+
This function returns a pattern that matches the first, second, or any additional characters provided. It is a shorthand function for a character class.
var pattern = Pattern
.With()
.OneOf('a', 'b', '-', '+'));Result: [az-+]
var pattern = Pattern
.With()
.OneOf(Quantifier.OneOrZero, 'a', 'b', '-', '+'));Result: [az-+]+
It's also possible to create a OneOf based on additional patterns.
var pattern = Pattern
.With()
.OneOf(
p => p.Digit(),
p => p.Word()
); Result: ((\d)|(\w))
Adds a range of characters to the character class.
var pattern = Pattern
.With()
.CharacterClass(cc => cc.Range('a', 'z'));Result: [a-z]
var pattern = Pattern
.With()
.CharacterClass(Quantifier.OneOrMore, cc => cc.Range('a', 'z'));Result: [a-z]+
Adds a set of characters to the character class.
var pattern = Pattern
.With()
.CharacterClass(cc => cc.OneOf('a', 'b', '-', '+'));Result: [az-+]
var pattern = Pattern
.With()
.CharacterClass(Quantifier.OneOrMore, cc => cc.OneOf('a', 'b', '-', '+'));Result: [az-+]+
Represents zero or more occurrences of the previous element.
var pattern = Pattern
.With()
.Digit(Quantifier.ZeroOrMore);Result: \d*
Represents zero or more occurrences of the previous element, matched lazily.
var pattern = Pattern
.With()
.Digit(Quantifier.ZeroOrMoreLazy);Result: \d*?
Represents one or more occurrences of the previous element.
var pattern = Pattern
.With()
.Digit(Quantifier.OneOrMore);Result: \d+
Represents one or more occurrences of the previous element, matched lazily.
var pattern = Pattern
.With()
.Digit(Quantifier.OneOrMoreLazy);Result: \d+?
Represents zero or one occurrences of the previous element.
var pattern = Pattern
.With()
.Digit(Quantifier.Optional);Result: \d?
Represents exactly the specified number of occurrences of the previous element.
var pattern = Pattern
.With()
.Digit(Quantifier.Exactly(4));Result: \d{4}
In the case of exactly one, the API will omit the quantifier.
var pattern = Pattern
.With()
.Digit(Quantifier.Exactly(1));Result: \d
Represents at least the specified number of occurrences of the previous element.
var pattern = Pattern
.With()
.Digit(Quantifier.AtLeast(4));Result: \d{4,}
In the case of at least zero, the API will use the quantifier for ZeroOrMore.
var pattern = Pattern
.With()
.Digit(Quantifier.AtLeast(0));Result: \d*
In the case of at least one, the API will use the quantifier for OneOrMore.
var pattern = Pattern
.With()
.Digit(Quantifier.AtLeast(1));Result: \d+
Represents at most the specified number of occurrences of the previous element.
var pattern = Pattern
.With()
.Digit(Quantifier.AtMost(4));Result: \d{,4}
In the case of at most one, the API will use the quantifier for Optional.
var pattern = Pattern
.With()
.Digit(Quantifier.AtMost(1));Result: \d?
Represents a specific range of occurrences of the preceding element.
var pattern = Pattern
.With()
.Digit(Quantifier.Range(1,4));Result: \d{1,4}
In the case that min and max are equal, the API will use the quantifier for Exactly.
var pattern = Pattern
.With()
.Digit(Quantifier.Range(2,2));Result: \d{2}
In the case of a range from 0 to 1, the API will use the quantifier for Optional.
var pattern = Pattern
.With()
.Digit(Quantifier.Range(0,1));Result: \d?
In the case of a range from 0 to any value, the API will use the quantifier for AtLeast.
var pattern = Pattern
.With()
.Digit(Quantifier.Range(0,10));Result: \d{,10}