正则表达式,给我写个1,2,3,4 或者4,1,2,3 匹配出4 来 select regexp_substr('1,2,3,4','[4]') tony from dual; select regexp_substr('4,3,2,1','[4]') tony from dual; oracle 验证电话号码(手机号码): /** * 手机号码 * 移动:134[0-8],135,136,137,138,139,150,151,157,158,159,182,187,188 * 联通:130,131,132,152,155,156,185,186 * 电信:133,1349,153,180,189 */ select t.* from myregex t where regexp_like(t.name,'^1(3[0-9]|5[0-35-9]|8[025-9])[0-9]{8}$') select t.* from myregex t where regexp_like(t.name,'^1(3[0-9]|5[0-35-9]|8[025-9])?[0-9]{8}?$') select t.* from myregex t where regexp_like(t.name,'^1(3[[:digit:]]|5[0-35-9]|8[025-9])?[[:digit:]]{8}?$') /** * 中国移动:China Mobile * 134[0-8],135,136,137,138,139,150,151,157,158,159,182,187,188 */ select t.* from myregex t where regexp_like(t.name,'^1(34[0-8]?|3[5-9]?|5[017-9]?|8[278]?)[0-9]{8}$') select t.* from myregex t where regexp_like(t.name,'^1(34[0-8]?|3[5-9]?|5[017-9]?|8[278]?)[[:digit:]]{8}$') /** * 中国联通:China Unicom * 130,131,132,152,155,156,185,186 */ select t.* from myregex t where regexp_like(t.name,'^1(3[0-2]?|5[25-6]?|8[5-6]?)[0-9]{8}$') select t.* from myregex t where regexp_like(t.name,'^1(3[0-2]?|5[25-6]?|8[5-6]?)[[:digit:]]{8}$') /** * 中国电信:China Telecom * 133,1349,153,180,189 */ select t.* from myregex t where regexp_like(t.name,'^1((33?|53?|8[09]?)[0-9]?|349)[0-9]{7}$') select t.* from myregex t where regexp_like(t.name,'^1((33?|53?|8[09]?)[0-9]?|349)[[:digit:]]{7}$')
|