preg_ replace-仅URL;http”;并以“”结尾;.flv”;


preg_replace - only URL which is starting from "http" and ending by ".flv"

我正在尝试创建一个替换项,删除不在"http://"answers".flv".之间的所有内容

这是我的代码:

preg_replace('"http://(.*?).f;v"', '', $code);

但它不起作用。有人能帮我吗?

谢谢。

删除所有不在"http://"answers".flv"之间的内容

http://example.com/path/test.flv?param=1-->example.com/path/test

顺便说一句,您在f;v中有一个拼写错误,您的分隔符可能会造成问题。更换

preg_replace('"http://(.*?).f;v"', '', $code);

带有

preg_replace('/http':'/'/(.*?)'.flv.*/i', '$1', $code);

你在寻找这样的东西吗:

http:'/'/(.*?).flv

http://www.somesite.com/ac.flv

演示:https://regex101.com/r/tN2tG2/1

相关文章: