Package snap.parse

Class Regex

java.lang.Object
snap.parse.Regex

public class Regex extends Object
A class for building regular expressions like a string buffer.
  • Constructor Details

    • Regex

      public Regex(String aName, String aPattern)
      Constructor with given pattern and name.
  • Method Details

    • getName

      public String getName()
      Returns the regex name.
    • getPattern

      public String getPattern()
      Returns the regex pattern.
    • isLiteral

      public boolean isLiteral()
      Returns whether pattern is literal.
    • getPatternCompiled

      public Pattern getPatternCompiled()
      Returns the compiled pattern.
    • getMatcher

      public Matcher getMatcher()
      Returns the shared matcher.
    • getLiteralLength

      public int getLiteralLength()
      Returns the literal length of this regex (the number of literal chars in the prefix).
    • getLiteralChar

      public char getLiteralChar()
      Returns the first literal in regex pattern (or 0 if not literal).
    • isMatchingStartChar

      public boolean isMatchingStartChar(char aChar, String charStr)
      Returns whether given regex matches given start char.
    • toString

      public String toString()
      Returns a string representation of regex.
      Overrides:
      toString in class Object