I am trying to combine a regular expression for two cases in a query to ClickHouse DataBase:
- Up to symbol "@" =>
(^[^@]+)
- Without domain 'company\' and 'company.com\' =>
(?:company\.com\\\\\\\\+|company\\\\\\\\+)(.*)
I have two ways that I found using the "regex online" :
^company\\\\(.*)|^(.*)@|^(?!company\\\\.*).*$
(?<=company\\\\)(.*)|(.*)(?<=@)|^(?!company\\\\.*).*
But, constructions ?!
and ?<=
are not supported (error : invalid perl operator).
I've used command extract
, e.g. extract(User, '(?<=company\\\\)(.*)|(.*)(?<=@)|^(?!company\\\\.*).*')
Could you give me some advice to understand how to make this regex suitable way, please.
In brackets - should pass, out of - shouldn't:
- company\[ABC-1D2E]
- [ABC-DE]@company.com
- [123-ABCDE]
- [12345]