regex - 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;
解决方案
regexp_substr(description,'([^A-Z]|^)[CT].{1,20}(CHEST|THOR|LUNG)',1,1,'i')
作品
推荐阅读
- mysql - Amazon Lightsail vs Amazon RDS
- javascript - 使隐藏元素显示自身,然后使用过渡移动
- r - R中的dplyr过滤器和for循环
- python - How to make the GUI using Tkinter of the format specified below?
- php - Removing duplicates from merged array
- django - pass the foreign key of a model in the url
- docker - Docker EE UCP - How to resolve x509 error when deploying stack?
- python-3.x - TypeError:只能使用标量值执行操作
- android - AdapterDataObserver 的 onChange 方法有效,但会在一瞬间显示 emptyView
- django - django ForeignKey 获取 to_field