我的字符串中有如下 URL:
subdomain.domain.com/ups/a/b.gif
www.domain.com/ups/c/k.gif
subdomain1.domain.com/ups/l/k.docx
Run Code Online (Sandbox Code Playgroud)
希望替换所有 URL,如下所示:
anydomain.com/ups/a/b.gif
anydomain.com/ups/c/k.gif
anydomain.com/ups/l/k.docx
Run Code Online (Sandbox Code Playgroud)
在上面的字符串中(URL + ups)是常见的匹配。所有 URL 都以 HTTP 或 HTTPS 开头。
php ×1