首页 > 解决方案 > regexp 语句中没有前面的字符

问题描述

因此,我尝试在正则表达式语句中使用负面回顾,并在网上查看了其他解决方案,但它们似乎对我不起作用,所以很明显我做错了-

我正在寻找第一行的回报,但其他人应该为空。基本上我需要 CT CHEST 或 CT LUNG 任何帮助 TIA

with test (id, description) as (
  select 1, 'CT CHEST HIGH RESOLUTION, NO CONTRAST'                         from dual union all --want this
  select 2, 'INJECTION, THORACIC TRANSFORAMEN EPIDURAL, NON NEUROLYTIC W IMAGE GUIDANCE.'                 from dual union all   --do not want this
  select 3, 'The cow came back. But the dog went for a walk'    from dual) --do not want this 
  select id, description, regexp_substr(description, '(?<![a-z]ct).{1,20}(CHEST|THOR|LUNG)',1,1,'i') from test;

标签: regexoracle

解决方案


regexp_substr(description,'([^A-Z]|^)[CT].{1,20}(CHEST|THOR|LUNG)',1,1,'i') 

作品


推荐阅读