Class RegularExpressions


  • public class RegularExpressions
    extends Object
    Utility methods for Regular Expressions.
    • Method Detail

      • replaceDollarAnchors

        public static String replaceDollarAnchors​(String regex)
        The meaning of $ in ecmascript does not allow newlines while for other languages it is typically allowed. The closest to the meaning in ecmascript is \z.
        Parameters:
        regex - the regex
        Returns:
        the replacement
      • replaceLongformCharacterProperties

        public static String replaceLongformCharacterProperties​(String regex)
        Replaces the longform character properties with the shortform character propertise.
        Parameters:
        regex - the regex
        Returns:
        the replacement
      • replaceCharacterProperties

        public static String replaceCharacterProperties​(String regex,
                                                        Map<String,​String> replacements)
        The character properties in JDK is different from ECMA.
        Parameters:
        regex - the regex
        Returns:
        the replacement