如何使用配置单元中的正则表达式排除字符串中的特殊字符 [英] How to exclude special characters in a string using regular expressions in hive
问题描述
我想排除句点(。
)和大括号((
,)
)。
但是,十进制数字应该保持不变
因此,基本上如果输入是
Hive仅支持FROM子句中的子查询(通过Hive 0.12)。
子查询必须被赋予一个名称,因为FROM
子句中的每个表都必须有一个名称。子查询选择列表中的列必须具有
的唯一名称。
输出应该是
Hive仅通过Hive支持FROM子句中的子查询0.12必须为
子查询赋予一个名称,因为FROM子句
中的每个表都必须具有在子查询选择列表中的名称Columns必须具有唯一的
名称
<$ p $ (选择'Hive仅在FROM子句中支持子查询(通过Hive 0.12)。子查询必须被赋予一个名称,因为FROM子句中的每个表都必须有一个名称。子查询选择列表必须具有唯一的名称 '作为mycol)
选择REGEXP_REPLACE(mycol,'(\\d + \\.\\d +)| [()] ','$ 1'),'\\((。*?)\\''
from t
Hive仅支持FROM子句中的子查询rough Hive 0.12
子查询必须被赋予一个名称,因为FROM子句
中的每个表都必须有一个名称子查询选择列表中的列必须具有唯一的
名称
I want to exclude periods(.
) and braces ((
,)
).
However, decimal numbers should be left intact
So basically if the input is
Hive supports subqueries only in the FROM clause (through Hive 0.12). The subquery has to be given a name because every table in a FROM clause must have a name. Columns in the subquery select list must have unique names.
The output should be
Hive supports subqueries only in the FROM clause through Hive 0.12 The subquery has to be given a name because every table in a FROM clause must have a name Columns in the subquery select list must have unique names
with t as (select 'Hive supports subqueries only in the FROM clause (through Hive 0.12). The subquery has to be given a name because every table in a FROM clause must have a name. Columns in the subquery select list must have unique names.' as mycol)
select regexp_replace(mycol,'(\\d+\\.\\d+)|[.()]','$1'),'\\((.*?)\\)'
from t
Hive supports subqueries only in the FROM clause through Hive 0.12 The subquery has to be given a name because every table in a FROM clause must have a name Columns in the subquery select list must have unique names
这篇关于如何使用配置单元中的正则表达式排除字符串中的特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!