首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > oracle >

oracle 正则表达式 匹配汉字,该怎么解决

2013-01-25 
oracle 正则表达式匹配汉字本帖最后由 yuzhong218 于 2012-09-21 13:03:11 编辑请问oracle正则表达式只是

oracle 正则表达式 匹配汉字
本帖最后由 yuzhong218 于 2012-09-21 13:03:11 编辑 请问oracle正则表达式只是单纯的匹配汉字应该怎么写啊?比如大家好"和"大家好!"和"大家好!123"和"大家好abc"结果就只要第一个,后面的不显示,这样的正则表达式应该怎么写啊?或者单纯的sql能够实现也可以
[解决办法]


--判斷全為雙字節就可以了
with t(col) as(
select '大家好' from dual
union all select '大家好!' from dual
)
select col from t where length(col)*2=lengthb(col);

[解决办法]
引用:
不可以啊,因为有可能有全角字符


with t(col) as(
select '大家好' from dual
union all select '大家好!' from dual
union all select '大家好‘' from dual
)
select col from t where length(col)*2=lengthb(col)
and regexp_like(col,'^[^[:punct:]]*$');
/*

COL                                                                             
--------                                                                        
大家好  
*/

热点排行
Bad Request.