Bug - Databricks requires extra escapes in repl string in regexp_replace (compared to Spark)

Twilight
Contributor

In Spark (but not Databricks), these work:

regexp_replace('1234567890abc', '^(?<one>\\w)(?<two>\\w)(?<three>\\w)', '$3$2$1')
regexp_replace('1234567890abc', '^(?<one>\\w)(?<two>\\w)(?<three>\\w)', '${three}${two}${one}')

In Databricks, you have to use these instead:

regexp_replace('1234567890abc', '^(?<one>\\w)(?<two>\\w)(?<three>\\w)', '\$3\$2\$1')
regexp_replace('1234567890abc', '^(?<one>\\w)(?<two>\\w)(?<three>\\w)', '\$\{three}\$\{two}\$\{one}')

All regexes above result in 3214567890abc