连号的现在已经解决了,1234或4321这种递增或递减的搞不出来了,(?:(?:0(?=1)|1(?=2)|2(?=3)|3(?=4)|4(?=5)|5(?=6)|6(?=7)|7(?=8)|8(?=9)){5}|(?:9(?=8)|8(?=7)|7(?=6)|6(?=5)|5(?=4)|4(?=3)|3(?=2)|2(?=1)|1(?=0)){5}),这个在oracle中跑没有结果,哪位兄弟对正则表达式比较了解的,指点一下吧
------解决方案--------------------
- SQL code
-------如果你查询出来的结果只有一行为连号,如果有多行非连号SQL> SQL> select rn 2 from (select rs, rs - row_number() over(order by 1) rn 3 from (select regexp_substr('12345', '\d', 1, rownum) rs 4 from dual 5 connect by rownum <= length('12345'))) 6 group by rn 7 ; RN---------- 0SQL> SQL> select rn 2 from (select rs, rs - row_number() over(order by 1) rn 3 from (select regexp_substr('15268', '\d', 1, rownum) rs 4 from dual 5 connect by rownum <= length('15268'))) 6 group by rn 7 ; RN---------- 2 3 -1 0SQL>
------解决方案--------------------
正则表达式里,好像没有支持这种计算。
倒是可以帮着优化一下 连号的代码
- SQL code
where regexp_like( 4位号码 ,'^([[:digit:]])\1{3}$')