그래서 나는 주로 regexp_like를 사용하고 regexp_substr-가 아니라 아래의 문자열에서
'abc 3/4/16 blah blah 3/7/16 imp 2/8/15 xxx cc2'
'3/10/18 bla bla imp-3/9/17 xfe 334 3/4/13'
I want to capture
imp 2/8/15 xxx cc2
imp-3/9/17 xfe
regexp_like에서는 단순히 regexp_like ( 'abc 3/4/16 blah blah 3/7/16 imp 2/8/15 xxx cc2', '(imp). {0,20} (cc2 | xfe)')가됩니다. 하지만 regexp_substr과 같은 방식으로 작동하지 않습니다.
이 코드를 성공없이 사용해 보았습니다.
with test (id, col) as
(select 1, 'abc 3/4/16 blah blah IMP 3/7/16' from dual union all
select 2, 'abc 3/4/16 blah blah 3/7/16 imp 2/8/15 xxx cc2' from dual union all
select 3, 'xxx 3/5/18 ccdd 234 imp happened on 5/8/19 some 23f' from dual union all
select 4, '3/10/18 bla bla imp-3/9/17 xfe 334 3/4/13 x' from dual
)
select id,
regexp_substr('(imp).*(xxx|xfe)',1) result
from test;
대소 문자를 고려해야합니다!
제안 감사합니다. 감사합니다
col
쿼리에서 전혀 사용하지 않습니다 .
이 시도:
with test (id, col) as
(select 1, 'abc 3/4/16 blah blah IMP 3/7/16' from dual union all
select 2, 'abc 3/4/16 blah blah 3/7/16 imp 2/8/15 xxx cc2' from dual union all
select 3, 'xxx 3/5/18 ccdd 234 imp happened on 5/8/19 some 23f' from dual union all
select 4, '3/10/18 bla bla imp-3/9/17 xfe 334 3/4/13 x' from dual
)
select id,
regexp_substr(col, '(imp).*(xxx|xfe)',1, 1) result -- use occurance as 1, last parameter
from test;
건배!!
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다