Class RegexpHelper
java.lang.Object
dev.frostlake.functions.scalar.string.RegexpHelper
Shared helpers for the REGEXP_* functions: translating Snowflake's
regex_parameters flag string
to Pattern flags, detecting the e (extract) flag, and converting a
Snowflake replacement string (backreferences \0–\9) to Java's replacement syntax.-
Method Summary
Modifier and TypeMethodDescriptionstatic PatternCompile a Snowflake pattern honoring thei/m/sflags inparameters, cached by (flags, pattern) — normally constant across rows.static booleanhasExtract(String parameters) Whether thee(extract submatch) flag is present in the parameters string.static inttoJavaFlags(String parameters) Map Snowflakeregex_parameterstojava.util.regexflags:i→ CASE_INSENSITIVE,m→ MULTILINE,s→ DOTALL.static StringtranslateReplacement(String replacement) Convert a Snowflake replacement string to aMatcher.appendReplacementreplacement: a backslash-digit (\1) becomes$1;\\a literal backslash; a bare$or trailing\is escaped so it is treated literally.
-
Method Details
-
toJavaFlags
Map Snowflakeregex_parameterstojava.util.regexflags:i→ CASE_INSENSITIVE,m→ MULTILINE,s→ DOTALL.c(case-sensitive, the default) ande(handled by the caller) contribute no flag; unknown characters are ignored. -
hasExtract
Whether thee(extract submatch) flag is present in the parameters string. -
compile
Compile a Snowflake pattern honoring thei/m/sflags inparameters, cached by (flags, pattern) — normally constant across rows. -
translateReplacement
Convert a Snowflake replacement string to aMatcher.appendReplacementreplacement: a backslash-digit (\1) becomes$1;\\a literal backslash; a bare$or trailing\is escaped so it is treated literally.
-