hive中 regexp_replace的用法,替换特殊字符问题
2018-11-07 20:22
2386 查看
数据仓库中有的字段不合格,有特殊字符,比如换行符。
poi_name \n19013 \n12013
怎么把换行符替换掉呢?
regexp_replace(string INITIAL_STRING, string PATTERN, string REPLACEMENT)
Returns the string resulting from replacing all substrings in INITIAL_STRING that match the java regular expression syntax defined in PATTERN with instances of REPLACEMENT. For example, regexp_replace("foobar", "oo|ar", "") returns 'fb.' Note that some care is necessary in using predefined character classes: using '\s' as the second argument will match the letter s; '\s' is necessary to match whitespace, etc.
官网说用两个反斜杠代替一个,即一个反斜杠用来转义。
实践了一下,不行,得4个
select regexp_replace(poi_name,'\\\\n','') poi_name 19013 12013
相关文章推荐
- php str_replace替换特殊字符
- mysql中replace、regexp正则表达式替换用法
- python替换UTF-8编码文本中任意特殊字符,包括中文符号问题:大量文本,将其中的特殊字符用空
- SQL中的REPLACE替换字符函数的用法(使之支持text/ntext) (2
- javascript 正则替换 replace(regExp, function)用法
- javascript 正则替换 replace(regExp, function)用法
- java String.replaceAll中特殊字符问题
- SQL中的REPLACE替换字符函数的用法(使之支持text/ntext)
- hive udf函数替换特殊字符
- JAVA中REPLACE和REPLACEALL的区别 以及一些特殊字符替换
- MySQL中使用replace、regexp进行正则表达式替换的用法分析
- HTML特殊字符替换问题 html escape相关
- PLSQL_基础系列12_替换函数用法REPLACE / TRANSLATE / REGEXP_REPLACE
- java字符串特殊替换及无法比较字符问题
- java replaceall 用法:处理特殊字符
- notepad++用法 缩进设置 特殊字符替换
- JS Replace 全部替换字符的用法小结
- single character replace program 文本中单个字符的替换,支持一些特殊的字符。
- SQL中的REPLACE替换字符函数的用法(使之支持textntext)
- ORACLE中的字符串替换 replce、regexp_replace 和 translate