fn regex_like(
pattern: &str,
case_insensitive: bool,
) -> Result<Regex, ArrowError>
Expand description
Transforms a like pattern
to a regex compatible pattern. To achieve that, it does:
- Replace
LIKE
multi-character wildcards%
=>.*
(unless they’re at the start or end of the pattern, where the regex is just truncated - e.g.%foo%
=>foo
rather than^.*foo.*$
) - Replace
LIKE
single-character wildcards_
=>.
- Escape regex meta characters to match them and not be evaluated as regex special chars. e.g.
.
=>\\.
- Replace escaped
LIKE
wildcards removing the escape characters to be able to match it as a regex. e.g.\\%
=>%