Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
463 views
in Technique[技术] by (71.8m points)

regex - Use raw strings in ClickHouse

I'm using regex to make some searches on strings with ClickHouse and as the docs say here

Note that the backslash symbol () is used for escaping in the regular expression. The same symbol is used for escaping in string literals. So in order to escape the symbol in a regular expression, you must write two backslashes () in a string literal.

Is it a way to tell ClickHouse to parse a string like a raw string, so that I don't have to use double backslashes in all patterns? Something like doing r'...' in Python?

question from:https://stackoverflow.com/questions/65883848/use-raw-strings-in-clickhouse

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

No way.

Something like doing r'...' in Python

Then how you encode this 'xxx'yyy' ?

You can encode strings

https://clickhouse.tech/docs/en/sql-reference/functions/encoding-functions/#unhexstr

https://clickhouse.tech/docs/en/sql-reference/functions/string-functions/#base64decode

Or you can use RowBinary format.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...