Class Literals

java.lang.Object
dev.yasint.regexsynth.ast.Literals

public final class Literals
extends java.lang.Object
  • Constructor Summary

    Constructors 
    Constructor Description
    Literals()  
  • Method Summary

    Modifier and Type Method Description
    static Expression literal​(java.lang.String literals)
    Treats a given string as a literal inside the regular expression.
    static Expression quotedLiteral​(java.lang.String literals)
    Encloses a given string in quoted literals using the regex construct \Q...\E The whole string will be treated as a string literal.
    static Expression unicodeClass​(UnicodeScript block, boolean negated)
    Appends the given unicode block to the expression.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • literal

      public static Expression literal​(java.lang.String literals)
      Treats a given string as a literal inside the regular expression. All the reserved characters will be escaped using the backslash character.
      Parameters:
      literals - some string
      Returns:
      escaped literal
    • quotedLiteral

      public static Expression quotedLiteral​(java.lang.String literals)
      Encloses a given string in quoted literals using the regex construct \Q...\E The whole string will be treated as a string literal.
      Parameters:
      literals - some string or text
      Returns:
      strict quoted literal string or text
    • unicodeClass

      public static Expression unicodeClass​(UnicodeScript block, boolean negated)
      Appends the given unicode block to the expression. It can only be one of the values from the list (https://github.com/google/re2/wiki/Syntax). And you can negate the unicode class by specifying the negated to true or false.
      Parameters:
      block - unicode general category block / script block
      negated - whether the block is negated or not
      Returns:
      unicode character block