簡體   English   中英

Oracle正則表達式可刪除除引號和點內的所有字符

[英]Oracle Regular expression to remove all charaters except those within Quotes and Dot

如何使用oracle正則表達式排除所有用雙引號和點(。)括起來的字符?

例如

樣本輸入

“ Abc”。“ EFG”與“ EFG”。“ ABC”。“ FIJ”不同

預期產量

“ Abc”。“ EFG”“ EFG”。“ ABC”。“ FIJ”

這是我的嘗試:

WITH A AS
  (SELECT 'and "EFG"."ABC"."FIG" is not the same as "Abc"."EFG" bla' AS text FROM DUAL),
b as (
SELECT 
    text, 
    REGEXP_SUBSTR(text, '("[[:alnum:]]*"\.)+"[[:alnum:]]*"',1,level) part, 
    level l
  FROM a
  connect by 
    REGEXP_SUBSTR(text, '("[[:alnum:]]*"\.)+"[[:alnum:]]*"',1,level) is not null
  )
select listagg(b.part,' ') within group (order by l)
from b;   

它提取格式為("[[:alnum:]]*"\\.)+"[[:alnum:]]*"並將它們串聯起來。

它不是完美的,但你的問題的規范是不是太嚴謹。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM