本文主要是介绍Hive, regexp_replace用法,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
把INITIAL_STRING中与PATTERN相匹配的子串替换为REPLACEMENT
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.
官网说用两个反斜杠代替一个,即一个反斜杠用来转义。
hive> select regexp_replace('\n123\n','\n','456') ;
OK
456123456
Time taken: 0.269 seconds, Fetched: 1 row(s)
hive> select regexp_replace('\n123\n','\n','') ;
OK
123
Time taken: 0.
这篇关于Hive, regexp_replace用法的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!