cloud-fan commented on code in PR #43203:
URL: https://github.com/apache/spark/pull/43203#discussion_r1347719104


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/regexpExpressions.scala:
##########
@@ -421,12 +427,14 @@ case class NotLikeAny(child: Expression, patterns: 
Seq[UTF8String]) extends Like
       * regexp - a string expression. The regex string should be a Java 
regular expression.
 
           Since Spark 2.0, string literals (including regex patterns) are 
unescaped in our SQL
-          parser. For example, to match "\abc", a regular expression for 
`regexp` can be
-          "^\\abc$".
+          parser, see the unescaping rules at <a 
href="https://spark.apache.org/docs/latest/sql-ref-literals.html#string-literal";>String
 Literal</a>.
+          For example, to match "\abc", a regular expression for `regexp` can 
be "^\\abc$".
 
           There is a SQL config 'spark.sql.parser.escapedStringLiterals' that 
can be used to
           fallback to the Spark 1.6 behavior regarding string literal parsing. 
For example,
-          if the config is enabled, the `regexp` that can match "\abc" is 
"^\abc$".
+          if the config is enabled, the `regexp` that can match "\abc" is 
"^\abc$".<br><br>
+          It's recommended to use a raw string literal (with the `r` prefix) 
to avoid escaping
+          special characters in the pattern string if exists.
   """,
   examples = """

Review Comment:
   Can we update the examples to use raw string literal?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to