- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2023 04:54 AM
@Stephen Wilcoxon : No, it is not a bug. Databricks uses a different flavor of regular expression syntax than Apache Spark. In particular, Databricks uses Java's regular expression syntax, whereas Apache Spark uses Scala's regular expression syntax. Java and Scala have some differences in their regular expression syntax, which may require different escaping of certain characters.
For example, in Java regular expressions, the backslash character itself needs to be escaped with another backslash. So, if you want to replace a string with a backslash followed by the letter 'n', you need to use four backslashes in the replacement string: "\\n". In Scala regular expressions, you only need two backslashes: "\n".
Therefore, if you are porting regular expressions from Spark to Databricks, you may need to adjust the regular expression and/or the replacement string to match Databricks' syntax.
Hope this helps.