Class Regex


  • public final class Regex
    extends Object
    • Method Detail

      • extractGroups

        public static Stream<String> extractGroups​(CharSequence text,
                                                   Pattern pattern)
        Extract the groups from text which matches the given pattern.
        Parameters:
        text - the text to extract from
        pattern - The pattern which contains groups to extract.
        Returns:
        The extracted groups. If the pattern does not match or does not define any groups, the empty stream is returned.
      • groups

        public static Stream<String> groups​(Matcher matcher)
        Extract the groups from a Matcher, if a match is found.
        Parameters:
        matcher - the Matcher.
        Returns:
        The extracted groups, or the empty stream if no match is found or no groups are defined.