使用带有Impala SQL的正则表达式在最后一个\\之后选择字符串

使用带有Impala SQL的正则表达式在最后一个\\之后选择字符串,sql,regex,impala,Sql,Regex,Impala,我有一个数据集,其中有一列包含进程和路径。我正在尝试使用带有Impala的正则表达式来剥离可执行文件。数据集如下所示: C:\\Windows\\System32\\svchost.exe C:\\Windows\\System32\\conhost.exe C:\\Windows\\System32\\net1.exe C:\\Windows\\System32\\schtasks.exe C:\\Program Files (x86)\\Citrix\\ICA Client\\SelfSer

我有一个数据集,其中有一列包含进程和路径。我正在尝试使用带有Impala的正则表达式来剥离可执行文件。数据集如下所示:

C:\\Windows\\System32\\svchost.exe
C:\\Windows\\System32\\conhost.exe
C:\\Windows\\System32\\net1.exe
C:\\Windows\\System32\\schtasks.exe
C:\\Program Files (x86)\\Citrix\\ICA Client\\SelfServicePlugin\\SelfService.exe
C:\\Windows\\System32\\backgroundTaskHost.exe
C:\\Windows\\System32\\net.exe
C:\\Windows\\System32\\conhost.exe
C:\\Program Files (x86)\\Wireless AutoSwitch\\wrlssw.exe
期望输出:

svchost.exe
conhost.exe
net1.exe
schtasks.exe
SelfService.exe
backgroundTaskHost.exe
net.exe
conhost.exe
wrlssw.exe
我尝试过许多类似下面两个的查询,但总是出错

select regexp_extract(w.destinationprocessname, '([^\\]+)$')
from winworkstations_realtime w
where w.externalid = '4688'
limit 10
错误:

AnalysisException: No matching function with signature: regexp_replace(STRING, STRING).

select regexp_extract(w.destinationprocessname, '\\(?:.(?!\\))+$',0)
from winworkstations_realtime w
where w.externalid = '4688'
limit 10
Could not compile regexp pattern: \(?:.(?!\))+$ Error: invalid perl operator: (?!
错误:

AnalysisException: No matching function with signature: regexp_replace(STRING, STRING).

select regexp_extract(w.destinationprocessname, '\\(?:.(?!\\))+$',0)
from winworkstations_realtime w
where w.externalid = '4688'
limit 10
Could not compile regexp pattern: \(?:.(?!\))+$ Error: invalid perl operator: (?!

想从任何对黑斑羚或正则表达式很好的人那里得到一些指导。

不是正则表达式专家,我相信有更好的方法,但这确实有效

select regexp_replace(regexp_extract("C:\\\Windows\\\\System32\\\\svchost.exe", ".+(\\\\.+)$", 1), "\\\\", "");

你知道你使用的是什么版本的ImpalaSQL吗?也许,
regex\u replace
只在更新版本中实施……statestored版本2.10.0-cdh5.13.0 RELEASE@AdrianoValente