假定银行要求其营业厅的卡号格式为:1010 3576 xxxx xxx开始,每4位号码后有空格 1010 3576是固定的,后8位任意数字,就可以这样定义正规表达式:
with t as
(
select '1010 3576 1234 123' id from dual union all
select '1010 3576 1234123' id from dual union all
select '1010 35761234 123' id from dual union all
select '1010 3576 1x34 123' id from dual union all
select '1010 2576 1234 103' id from dual union all
select '1010 35761234123' id from dual union all
select '1010 3576 0234 123' id from dual
)
select * from t where regexp_like(id,'1010 3576 [[:digit:]]{4} [[:digit:]]{3}');
[0-9]{19},
银行卡号是19 个0-9的数字组成
网上搜集一大把