Class RECompiler


  • public class RECompiler
    extends java.lang.Object
    A regular expression compiler class. This class compiles a pattern string into a regular expression program interpretable by the RE evaluator class. The 'recompile' command line tool uses this compiler to pre-compile regular expressions for use with RE. For a description of the syntax accepted by RECompiler and what you can do with regular expressions, see the documentation for the RE matcher class.
    See Also:
    REMatcher
    • Constructor Detail

      • RECompiler

        public RECompiler()
        Constructor. Creates (initially empty) storage for a regular expression program.
    • Method Detail

      • setFlags

        public void setFlags​(REFlags flags)
        Set the regular expression flags to be used
        Parameters:
        flags - the regular expression flags
      • getWarnings

        public java.util.List<java.lang.String> getWarnings()
        On completion of compilation, get any warnings that were generated
        Returns:
        the list of warning messages
      • makeUnion

        public static CharacterClass makeUnion​(CharacterClass p1,
                                               CharacterClass p2)
        Make the union of two IntPredicates (matches if p1 matches or p2 matches)
        Parameters:
        p1 - the first
        p2 - the second
        Returns:
        the result
      • makeDifference

        public static CharacterClass makeDifference​(CharacterClass p1,
                                                    CharacterClass p2)
        Make the difference of two IntPredicates (matches if p1 matches and p2 does not match)
        Parameters:
        p1 - the first
        p2 - the second
        Returns:
        the result
      • makeComplement

        public static CharacterClass makeComplement​(CharacterClass p1)
        Make the complement of an IntPredicate (matches if p1 does not match)
        Parameters:
        p1 - the operand
        Returns:
        the result
      • compile

        public REProgram compile​(UnicodeString pattern)
                          throws RESyntaxException
        Compiles a regular expression pattern into a program runnable by the pattern matcher class 'RE'.
        Parameters:
        pattern - Regular expression pattern to compile (see RECompiler class for details).
        Returns:
        A compiled regular expression program.
        Throws:
        RESyntaxException - Thrown if the regular expression has invalid syntax.
        See Also:
        RECompiler, REMatcher