Class Groups

java.lang.Object
dev.yasint.regexsynth.dsl.Groups

public final class Groups
extends java.lang.Object
Contains all the grouping constructs supported by the RE2 regex engine. Currently groups with modifiers are not supported.
Since:
1.0.0
  • Constructor Summary

    Constructors 
    Constructor Description
    Groups()  
  • Method Summary

    Modifier and Type Method Description
    static Expression captureGroup​(Expression... expressions)
    Creates a capturing group.
    static Expression namedCaptureGroup​(java.lang.String name, Expression... expressions)
    Creates a named capturing group.
    static Expression nonCaptureGroup​(Expression... expressions)
    Creates a non capturing group.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • nonCaptureGroup

      public static Expression nonCaptureGroup​(Expression... expressions)
      Creates a non capturing group. You can use this to group and to avoid unnecessary capturing, and the match process will be more efficient. As the name implies it will not include in the final result.
      Parameters:
      expressions - sub-expression of this group
      Returns:
      non-capturing group.
    • captureGroup

      public static Expression captureGroup​(Expression... expressions)
      Creates a capturing group. By using this you can group that part of the regular expression together. This allows you to apply a quantifier to a entire group or to restrict alternation to part of the regex.
      Parameters:
      expressions - sub-expressions of this group
      Returns:
      capturing group
    • namedCaptureGroup

      public static Expression namedCaptureGroup​(java.lang.String name, Expression... expressions)
      Creates a named capturing group. This is very much like the capturing group. it allows you to specify a capture group in the matched result. But also with a name to the group (?P<name>...)
      Parameters:
      name - name of this capturing group
      expressions - sub-expressions of this group
      Returns:
      named capturing group