正则 - 提取子串

前端之家收集整理的这篇文章主要介绍了正则 - 提取子串前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

11g版本:

 
 
  1. WITHtAS
  2. (
  3. SELECT'((:1*:1)+:2)/:10'col
  4. FROMdual
  5. UNIONALL
  6. SELECT'((:3*:0)+:323)/:1213lse12lj'FROMdual
  7. )
  8. SELECTcol,
  9. regexp_substr(col,
  10. '[0-9]+',
  11. 1,
  12. LEVEL)ASdd,
  13. LEVELASposition
  14. FROMt
  15. CONNECTBYLEVEL<=regexp_count(col,
  16. '[0-9]+')AND
  17. PRIORdbms_random.VALUEISNOTNULLAND
  18. PRIORcol=col
  19. ORDERSIBLINGSBYcol;

10g版本:

 
 
  1. WITHtAS
  2. (
  3. SELECT'((:1*:1)+:2)/:10'col
  4. FROMdual
  5. UNIONALL
  6. SELECT'((:3*:0)+:323)/:1213lse12lj'FROMdual
  7. )
  8. SELECTcol,
  9. LEVELASposition
  10. FROMt
  11. CONNECTBYLEVEL<=(length(regexp_replace(col,
  12. '[0-9]+',
  13. '~~~'))-
  14. length(REPLACE(regexp_replace(col,
  15. '[0-9]+',
  16. '~~~'),
  17. '~~~')))/3AND
  18. PRIORdbms_random.VALUEISNOTNULLAND
  19. PRIORcol=col
  20. ORDERSIBLINGSBYcol;

猜你在找的正则表达式相关文章