Question

My work involves manipulating lots of data. I use textwrangler as text editor but I guess the things would remain the same on all text editors.

So I have a url

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

The above one is a sample url

I want to capture the text GsdOfferOnWatches07. i.e text from offer= and till &ref using regular expression on textwragler Ctrl+F feature.

How can I do that?

Was it helpful?

Solution

$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];'
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top