匹配第三个'/'之后的字符串中的所有内容 [英] Match everything in a string after the 3rd '/'

查看:171
本文介绍了匹配第三个'/'之后的字符串中的所有内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两种不同形式的字符串:

I have two different forms of a string:

https://anexample.com/things/stuff

https:///things/stuff

我需要一个正则表达式,该表达式将匹配第三个斜杠之后的字符串中的所有内容,无论其语法如何.一旦打到第三个斜杠,其余的字符串就会被匹配.我找到了很多示例,但是我似乎无法调整正确的方法来使其正常工作.预先感谢.

I need a regular expression that will match everything in the string after the 3rd slash, no matter the syntax. Once it hits the 3rd slash, the rest of the string is matched. I have found a bunch of examples, but I can't seem to tweak the right way to get it to work. Thanks in advance.

推荐答案

您可以使用此

^[^/]*/[^/]*/[^/]*/(.*)$

这篇关于匹配第三个'/'之后的字符串中的所有内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆