Exemplo n.º 1
0
 /// <summary>
 /// A non-capturing group
 /// </summary>
 /// <param name="innerExpression"></param>
 /// <returns></returns>
 public RegexPattern Phrase(RegexPattern innerExpression)
 {
     _content.Append($"(?:{innerExpression})");
     return(this);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Matches any single character not contained within
 /// </summary>
 /// <param name="innerExpression"></param>
 /// <returns></returns>
 public RegexPattern NegatedSet(RegexPattern innerExpression)
 {
     _content.Append($"[^{innerExpression}]");
     return(this);
 }
Exemplo n.º 3
0
 /// <summary>
 /// A subset of the pattern that can be referenced as ordinal captures
 /// </summary>
 /// <param name="innerExpression"></param>
 /// <returns></returns>
 public RegexPattern Group(RegexPattern innerExpression)
 {
     _content.Append($"({innerExpression})");
     return(this);
 }
Exemplo n.º 4
0
 /// <summary>
 /// A subset of the pattern that can be referenced as a named capture
 /// </summary>
 /// <param name="groupName"></param>
 /// <param name="innerExpression"></param>
 /// <returns></returns>
 public RegexPattern NamedGroup(string groupName, RegexPattern innerExpression)
 {
     _content.AppendFormat("(?<{1}>{0})", innerExpression, groupName);
     return(this);
 }
Exemplo n.º 5
0
 public RegexLazyQuantifier(RegexPattern quantifiedExpression) : base(quantifiedExpression)
 {
 }
Exemplo n.º 6
0
 internal RegexQuantifier(RegexPattern quantifiedExpression)
 {
     _quantifiedExpression = quantifiedExpression;
 }
Exemplo n.º 7
0
 public RegexPattern If(int unnamedCaptureToMatch, RegexPattern then, RegexPattern otherwise)
 {
     return(_precedingRegexPattern.RegEx($"(?({unnamedCaptureToMatch}){then}|{otherwise})"));
 }
Exemplo n.º 8
0
 public RegexPattern If(string namedGroupToMatch, RegexPattern then, RegexPattern otherwise)
 {
     return(_precedingRegexPattern.RegEx($"(?({namedGroupToMatch}){then}|{otherwise})"));
 }
Exemplo n.º 9
0
 public RegexPattern If(RegexPattern matched, RegexPattern then, RegexPattern otherwise)
 {
     return(_precedingRegexPattern.RegEx($"(?(?={matched}){then}|{otherwise})"));
 }
Exemplo n.º 10
0
 public RegexPattern Either(RegexPattern firstOption, RegexPattern secondOption)
 {
     return(_precedingRegexPattern.RegEx($"({firstOption}|{secondOption})"));
 }
Exemplo n.º 11
0
 internal RegexAlternation(RegexPattern precedingRegexPattern)
 {
     _precedingRegexPattern = precedingRegexPattern;
 }