当我尝试使用regexp
来自以下来源的\|(.*?),1,2
提取时,我即将结束,但我需要第3 /只。当我使用\|(.*/){1,3},1,2
时,它正在给http://localhost:6148372/content/bdsajf
,而我却在结束搜索位置。请帮助我。
U=https://www.abcdf.com/aecb/app/login|http://llcwokhfkdvc.webs.com/sajc-services
U=http://localhost:7438/en.html|http://localhost:6148372/content/bdsajf/en/kjf-LKJf/FJKSF-cbxjs.html
O / P应为#http://llcwokhfkdvc.webs.com
和http://localhost:6148372
由于
答案 0 :(得分:1)
答案 1 :(得分:0)
尝试'\|([^/]*/){1,3}'
(11i):
SQL> SELECT regexp_substr(txt, '\|(([^/]*/){1,3})', 1, 1, 'i', '1') regexp
2 FROM DATA;
REGEXP
--------------------------------------------------------------------------------
http://llcwokhfkdvc.webs.com/
http://localhost:6148372/
在10g:
SQL> SELECT ltrim(regexp_substr(txt, '\|([^/]*/){1,3}'), '|') regexp
2 FROM DATA;
REGEXP
--------------------------------------------------------------------------------
http://llcwokhfkdvc.webs.com/
http://localhost:6148372/
答案 2 :(得分:0)
您可以尝试:
SELECT regexp_substr(t, '\|(http://.*?)/', 1, 1, NULL, 1)
FROM (
SELECT
'U=https://www.abcdf.com/aecb/app/login|http://llcwokhfkdvc.webs.com/sajc-services' AS t
FROM DUAL
UNION
SELECT
'U=http://localhost:7438/en.html|http://localhost:6148372/content/bdsajf/en/kjf-LKJf/FJKSF-cbxjs.htmlO/P should be # http://llcwokhfkdvc.webs.com and http://localhost:6148372' AS t
FROM DUAL
);