模式是:/(?:https?://)?(?:^.+.)?momento360.com/e/(.*)?/i
此regex模式在网站之后返回URL的其余部分。
[click here](https://momento360.com/e/uc/1478291a8dd94a8198339f1ffe4b97be?utm_campaign=embed&utm_source=other&size=medium)
https://momento360.com/e/u/a9b53aa8f8b0403ba7a4e18243aabc66
https://momento360.com/e/uc/1478291a8dd94a8198339f1ffe4b97be?upload-key=e84e1fb3567546a885a2a223bde6ef32但是现在我想忽略[click here](...)标记中的字符串
发布于 2021-03-08 09:18:55
您可以使用
\[click here]\(http[^()]*\)(*SKIP)(*F)|(?:https?:\/\/)?(?:[^.]+\.)?momento360\.com\/e\/(.*)见regex演示。
这里,
\[click here]\(http[^()]*\)(*SKIP)(*F) -匹配[click here](...)子字符串并跳过此匹配,在发生故障的位置开始搜索新匹配。(?:https?:\/\/)?(?:[^.]+\.)?momento360\.com\/e\/(.*) -匹配可选的http://或https://,然后匹配除点和点以外的任何1+字符的可选序列,然后是momento360.com/e/字符串,然后将除行中断字符以外的任何零个或多个字符捕获到组1中,尽可能多。发布于 2021-03-01 09:26:08
如果您想要设置的所有Urls都在()中,而其他Urls没有,则可以使用以下命令:
[^(]https?:?(?:[^.]+.)?momento360.com/e/(.*)?https://stackoverflow.com/questions/66419361
复制相似问题