Class RegexBuilder.RegexMatcher

java.lang.Object
ortus.boxlang.runtime.util.RegexBuilder.RegexMatcher
Enclosing class:
RegexBuilder

public static class RegexBuilder.RegexMatcher extends Object
The RegexMatcher class is used to match a pattern against an input string by either using a pre-complied pattern or a string pattern that will be compiled on the fly.
  • Method Details

    • match

      public RegexBuilder.RegexMatcher match(Pattern pattern)
      Compile the pattern from the given pattern
      Parameters:
      pattern - The pattern to compile
      Returns:
      The matcher instance
    • match

      public RegexBuilder.RegexMatcher match(String pattern)
      Compile the pattern from the given string with case sensitivity
      Parameters:
      pattern - The pattern to compile
      Returns:
      The matcher instance
    • match

      public RegexBuilder.RegexMatcher match(String pattern, Boolean noCase)
      Compile the pattern from the given string
      Parameters:
      pattern - The pattern to compile
      noCase - Whether the pattern should be case insensitive or not
      Returns:
      The matcher instance
    • match

      public RegexBuilder.RegexMatcher match(String pattern, Boolean noCase, int flags)
      Compile the pattern from the given string
      Parameters:
      pattern - The pattern to compile
      noCase - Whether the pattern should be case insensitive or not
      flags - The flags to use when compiling the pattern
      Returns:
      The matcher instance
    • matches

      public Boolean matches()
      Check if the input string matches the pattern
      Returns:
      True if the input string matches the pattern, false otherwise
    • matcher

      public Matcher matcher()
      Get the matcher instance for the input string and pattern
      Returns:
      The matcher instance
    • replaceAll

      public RegexBuilder.RegexMatcher replaceAll(String replacement)
      Replace all occurrences of the pattern in the input string with the replacement string
      Parameters:
      replacement - The replacement string
      Returns:
      The input string with all occurrences of the pattern replaced with the replacement string
    • replaceAll

      public RegexBuilder.RegexMatcher replaceAll(Pattern pattern, String replacement)
      Replace all occurrences of the pattern in the input string with the replacement string
      Parameters:
      pattern - The pattern to match against
      replacement - The replacement string
      Returns:
      The input string with all occurrences of the pattern replaced with the replacement string
    • replaceFirst

      public RegexBuilder.RegexMatcher replaceFirst(String replacement)
      Replace first occurrence of the pattern in the input string with the replacement string
      Parameters:
      replacement - The replacement string
      Returns:
      The input string with all occurrences of the pattern replaced with the replacement string
    • replaceFirst

      public RegexBuilder.RegexMatcher replaceFirst(Pattern pattern, String replacement)
      Replace first occurrence of the pattern in the input string with the replacement string
      Parameters:
      pattern - The pattern to match against
      replacement - The replacement string
      Returns:
      The input string with all occurrences of the pattern replaced with the replacement string
    • replaceAllAndGet

      public String replaceAllAndGet(String replacement)
      Replace all occurrences of the pattern in the input string with the replacement string
      Parameters:
      replacement - The replacement string
      Returns:
      The input string with all occurrences of the pattern replaced with the replacement string
    • replaceAllAndGet

      public String replaceAllAndGet(Pattern pattern, String replacement)
      Replace all occurrences of the pattern in the input string with the replacement string
      Parameters:
      replacement - The replacement string
      Returns:
      The input string with all occurrences of the pattern replaced with the replacement string
    • replaceFirstAndGet

      public String replaceFirstAndGet(Pattern pattern, String replacement)
      Replace first occurrence of the pattern in the input string with the replacement string
      Parameters:
      replacement - The replacement string
      Returns:
      The input string with all occurrences of the pattern replaced with the replacement string
    • replaceFirstAndGet

      public String replaceFirstAndGet(String replacement)
      Replace first occurrence of the pattern in the input string with the replacement string
      Parameters:
      replacement - The replacement string
      Returns:
      The input string with all occurrences of the pattern replaced with the replacement string
    • get

      public String get()
      Get's the input string as modified by the matcher
      Returns:
      The input string
    • reset

      public RegexBuilder.RegexMatcher reset()
      Reset the input string to the original value
      Returns:
      The matcher instance