0

当我尝试通过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.comhttp://localhost:6148372

谢谢

4

3 回答 3

1

试试下面的表达式:

\|([^/]*/*[^/]*)

观看现场演示

于 2013-10-07T11:52:28.450 回答
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/

10克:

SQL> SELECT ltrim(regexp_substr(txt, '\|([^/]*/){1,3}'), '|') regexp
  2    FROM DATA;

REGEXP
--------------------------------------------------------------------------------
http://llcwokhfkdvc.webs.com/
http://localhost:6148372/
于 2013-10-07T11:43:58.683 回答
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
);
于 2013-10-07T11:49:07.153 回答