select regexp_replace(trim(phone),'^(91|01)','') as phone --removes leading 91, 01 and all leading and trailing spaces
from table;
同样的用法 regexp_extract :
select regexp_extract(trim(phone),'^(91|01)?(\\d+)',2) as phone --removes leading and trailing spaces, extract numbers except first (91 or 01)
from table;
4条答案
按热度按时间66bbxpm51#
如果它们是字符串,则对于配置单元查询:
u91tlkcl2#
我认为这是一个改进,我更喜欢一个包含contains或等同于contains的列表,但下面是:
退货:
我们可能需要考虑+,但什么也没说。
toiithl63#
使用正则表达式
使用
regexp_replace
(如有必要,请添加更多扩展代码):同样的用法
regexp_extract
:agxfikkp4#
电话大小可以不同,可以使用这种结构(scala):