Oracle SQL 开发人员中的正则表达式模式:包括数字

Regular Expression patterns in Oracle SQL developer: include numbers

我正在尝试使用 oracle sql 开发人员查找模式。包括 "x0000"," 0000",".0000"

的数字
AND REGEXP_INSTR(string=>FTP.TEXT, pattern=>'[x]\d\d\d\d\s', match_parameter=>'i')

您可以按如下方式使用REGEXP_LIKE

SQL> --sample data
SQL> with your_data(id,str) as
  2  (select 1, 'x0000' from dual union all
  3  select 2, '.0000' from dual union all
  4  select 3, ' 0000'from dual union all
  5  select 4, '0000' from dual) -- this should not be in the result
  6  -- your query starts from here
  7  select * from your_data
  8  where REGEXP_like(str,'[x| |\.][0-9]{4}','i');

        ID STR
---------- -----
         1 x0000
         2 .0000
         3  0000

SQL>

使用

where REGEXP_LIKE(str,'[x.[:space:]]\d{4}','i')

[x.[:space:]]\d{4} 表达式匹配 x. 或任何空格,然后是任何四位数字字符。