如何使用正则表达式匹配行尾的URL

时间:2019-02-06 21:44:51

标签: regex url

我必须找到一种模式,仅匹配这样一个列表的URL:

one | two | three | four | http://www.site/whatever-the-site-uses
one | two | three | four | http://www.site/whatever-the-site-uses
one | two | three | four | http://www.site/whatever-the-site-uses

我需要在单个组中抓取整个http或https,但我无法为此找到一个好的模式

有人可以帮助我吗?到目前为止,我有\|(.*?)/$,但结果是类似

| two | three | four | http://www.site/whatever-the-site-uses

1 个答案:

答案 0 :(得分:0)

我明白你的意思吗?从最后一个“ | https://”捕获以 https?开头的组,直到该行的末尾

是吗?

/\|\ (https?\:\/\/.*)$/