Oracle正则表达式捕获特定字符

时间:2014-02-13 08:00:45

标签: regex oracle

这里是我想要做的更多理解我想找到它来获取子串并将其放入变量

DECLARE
   v_file_type      thufitab.file_type%TYPE;
   v_filename       thufitab.filename%TYPE;
   v_status         thufitab.status%TYPE;
   V_seq_FILENAME   NUMBER (4);

   CURSOR List_FILENAME_cur
   IS
      SELECT FILENAME
        FROM thufitab
       WHERE status = 2 AND ROWNUM <= 100;
BEGIN
   FOR List_FILENAME_rec IN List_FILENAME_cur
   LOOP
      SELECT REGEXP_SUBSTR (FILENAME, '([1-9][0-9]{0,3})')
        INTO V_seq_FILENAME
        FROM thufitab;

      DBMS_OUTPUT.PUT_LINE (V_seq_FILENAME);
   END LOOP;
END;

1 个答案:

答案 0 :(得分:0)

不确定我理解得很好,但是,这对你好吗?

'CDR-([1-9][0-9]{0,3})_[0-9]{2}_[0-9]{2}_[0-9]{2}_[0-9]{4}_UK1\.FCDR'
     ^_______________^
          group 1