Nuv Posted May 18, 2011 Share Posted May 18, 2011 I need to extract the get part of solre.php i.e. c=204436 in this case. <a href="solre.php?c=3-204436"class='nav' > The code i am using is preg_match_all('~<a\s+href="solre.php?(.*?)"class=\'nav\'\s+>~', $output, $out_new); When i var_dump($output); i see that i am getting that page. However $out_new is empty. Is there anything wrong with my regex ? Quote Link to comment https://forums.phpfreaks.com/topic/236712-wrong-regex/ Share on other sites More sharing options...
sasa Posted May 18, 2011 Share Posted May 18, 2011 are you sure about spaces try to use this pattern '~<a\s+href="solre.php?[^"]"\s*class=\'nav\'\s*>~' Quote Link to comment https://forums.phpfreaks.com/topic/236712-wrong-regex/#findComment-1216836 Share on other sites More sharing options...
Nuv Posted May 18, 2011 Author Share Posted May 18, 2011 are you sure about spaces try to use this pattern '~<a\s+href="solre.php?[^"]"\s*class=\'nav\'\s*>~' Thankyou for the help sasa. My regex was working too so as yours..however there was some other problem which i figured now. Quote Link to comment https://forums.phpfreaks.com/topic/236712-wrong-regex/#findComment-1217098 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.