mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
Add a note about double escaping in regexes.
This commit is contained in:
parent
fa219179f9
commit
be75df7c60
@ -281,7 +281,16 @@ OptimizedRegularExpressionImpl<thread_safe>::OptimizedRegularExpressionImpl(cons
|
|||||||
|
|
||||||
re2 = std::make_unique<RegexType>(regexp_, regexp_options);
|
re2 = std::make_unique<RegexType>(regexp_, regexp_options);
|
||||||
if (!re2->ok())
|
if (!re2->ok())
|
||||||
throw DB::Exception("OptimizedRegularExpression: cannot compile re2: " + regexp_ + ", error: " + re2->error() + ". Look at https://github.com/google/re2/wiki/Syntax for reference.", DB::ErrorCodes::CANNOT_COMPILE_REGEXP);
|
{
|
||||||
|
throw DB::Exception("OptimizedRegularExpression: cannot compile re2: "
|
||||||
|
+ regexp_ + ", error: " + re2->error()
|
||||||
|
+ ". Look at https://github.com/google/re2/wiki/Syntax "
|
||||||
|
"for reference. Please note that if you specify regex as an SQL "
|
||||||
|
"string literal, the slashes have to be additionally escaped. "
|
||||||
|
"For example, to match an opening brace, write '\\(' -- "
|
||||||
|
"the first slash is for SQL and the second one is for regex",
|
||||||
|
DB::ErrorCodes::CANNOT_COMPILE_REGEXP);
|
||||||
|
}
|
||||||
|
|
||||||
if (!is_no_capture)
|
if (!is_no_capture)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user