如何在配置单元中使用正则表达式排除字符串中的特殊字符
How to exclude special characters in a string using regular expressions in hive
我想排除句点 (.
) 和大括号 ((
,)
)。
但是,十进制数字应该保持原样
所以基本上如果输入是
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.
输出应该是
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+)|[.()]',''),'\((.*?)\)'
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
我想排除句点 (.
) 和大括号 ((
,)
)。
但是,十进制数字应该保持原样
所以基本上如果输入是
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.
输出应该是
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+)|[.()]',''),'\((.*?)\)'
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