如何在文本管理员中通过正则表达式提取 url 的一部分



我的工作涉及操作大量数据。我使用textwrangler作为文本编辑器,但我想所有文本编辑器上的事情都保持不变。

所以我有一个网址

 http://example.com/swatches/frisk-watches/pr?p[]=sort%3Dpopularity&sid=812%2Cf13&offer=GsdOfferOnWatches07.&ref=4c83d65f-bfaf-4db6-b5f5-d733d7b1d2af

上面的一个是示例网址

我想捕获文本 GsdOfferOnWatches07. 即来自 offer= 和 till &ref 的文本使用正则表达式在 textwragler Ctrl+F 功能上。

我该怎么做?

$link = 'http://example.com/swatches/frisk-watches/pr?p[]=sort%3Dpopularity&sid=812%2Cf13&offer=GsdOfferOnWatches07.&ref=4c83d65f-bfaf-4db6-b5f5-d733d7b1d2af';
preg_match('/offer=(.*?)&ref/', $link, $match);      
echo $match[1];'

最新更新