hive-sql截取汉字、字母和数字等
生活随笔
收集整理的這篇文章主要介紹了
hive-sql截取汉字、字母和数字等
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
在查詢字段中截取漢字、字母和數字等代碼如下:
1、截取數字
?2、截取字母
select regexp_extract('$%^&&*!(123hello你好,。.,','([a-zA-Z]+)',1); ---輸出:hello select regexp_extract('$%^&&*!(123hello你好,。.,','[^a-zA-Z]',''); ---輸出:hello??3、截取漢字
select regexp_extract('$%^&&*!(123hello你好,。.,','([\\\u4e00-\\\u9fa5]+)',1); ---輸出:你好 select regexp_replace('$%^&&*!(123hello你好,。.,','[^\\\u4e00-\\\u9fa5]',''); ---輸出:你好???4、截取字母、數字或漢字
select regexp_extract('$%^&&*!(123hello你好,。.,','([0-9a-zA-Z\\\u4e00-\\\u9fa5]+)',1); ---輸出:123hello你好 select regexp_replace('$%^&&*!(123hello你好,。.,','[^0-9a-zA-Z\\\u4e00-\\\u9fa5]',''); ---輸出:123hello你好總結
以上是生活随笔為你收集整理的hive-sql截取汉字、字母和数字等的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 报错及解决 ‘gbk‘ codec ca
- 下一篇: 晶体生长需要解决的13个问题