Package org.pcre4j

Class Pcre4jUtils

java.lang.Object
org.pcre4j.Pcre4jUtils

public final class Pcre4jUtils extends Object
  • Method Details

    • getErrorMessage

      public static String getErrorMessage(org.pcre4j.api.IPcre2 api, int errorcode)
      Get the error message for the given error code.
      Parameters:
      api - the PCRE2 API
      errorcode - the error code
      Returns:
      the error message
    • getGroupNames

      public static String[] getGroupNames(Pcre2Code code)
      Get the group names for the given code.
      Parameters:
      code - the PCRE2 compiled pattern
      Returns:
      an array where the index is the group number and the value is the group name or null if the group has no name
    • getMatchGroups

      public static String[] getMatchGroups(Pcre2Code code, String subject, Pcre2MatchData matchData)
      Get the match groups
      Parameters:
      code - the compiled pattern the match was performed with
      subject - the subject string the match was performed against
      matchData - the match data with the match results
      Returns:
      an array of strings where the index is the group number and the value is the matched group or null
    • getNamedMatchGroups

      public static Map<String,String> getNamedMatchGroups(Pcre2Code code, String subject, Pcre2MatchData matchData)
      Get the match named groups
      Parameters:
      code - the compiled pattern the match was performed with
      subject - the subject string the match was performed against
      matchData - the match data with the match results
      Returns:
      a map of group names to the matched group or null