Extract a parameter from URL using a regex in PHP

sky.saran

New Member
I have a number of links that look like:\[code\]<a href="http://url.com/?foo=bar&p=20" title="foo">Foo</a><a href="http://url2.com/?foo=bar&p=30" title="foo">Foo</a>\[/code\]I'm trying to extract the parameter \[code\]p\[/code\] from each \[code\]href\[/code\] found. So in this case I have an end result array as \[code\]array (20, 30)\[/code\].What would be a good regex for this? Thanks.
 
Back
Top