如何 trim 第一个文件夹的 url 列表
how to trim a list of urls to first folder
我想要 trim 第一个文件夹的 URL 列表
for example:
url.com/folder1/xxx/index.html
url.com/folder2/
url.com/folder3/xxx/yyyy/index.html
url.com/folder4/zzz/aaa/bbb/index.html
Output should look like this:
url.com/folder1/
url.com/folder2/
url.com/folder3/
url.com/folder4/
如有任何帮助,我们将不胜感激。
谢谢!
查找内容:
^([^/]*/[^/]*/).*
或
必要时转义正斜杠。
^([^\/]*\/[^\/]*\/).*
替换为:
查找: ^.*?\/.*?\/\K.*$
试试这个。替换为 empty string
。查看演示。
https://regex101.com/r/mS3tQ7/14
\K resets the starting point of the reported match. Any previously consumed characters are no longer included in the final match
我想要 trim 第一个文件夹的 URL 列表
for example:
url.com/folder1/xxx/index.html
url.com/folder2/
url.com/folder3/xxx/yyyy/index.html
url.com/folder4/zzz/aaa/bbb/index.html
Output should look like this:
url.com/folder1/
url.com/folder2/
url.com/folder3/
url.com/folder4/
如有任何帮助,我们将不胜感激。 谢谢!
查找内容:
^([^/]*/[^/]*/).*
或
必要时转义正斜杠。
^([^\/]*\/[^\/]*\/).*
替换为:
查找: ^.*?\/.*?\/\K.*$
试试这个。替换为 empty string
。查看演示。
https://regex101.com/r/mS3tQ7/14
\K resets the starting point of the reported match. Any previously consumed characters are no longer included in the final match