All4172 Posted July 13, 2006 Share Posted July 13, 2006 Normally when I want to pull info out I would do something like:[code]preg_match('!<meta name="name" content="(.*?)"/>!is', $contents, $meta);[/code]That would pull anything out between content="someinfo goes here"/>This time I'm attempting to say, if anything at all is between the quotes in content=" ">, then do this. How would I test that something is between the quotes? Link to comment https://forums.phpfreaks.com/topic/14516-basic-preg_match-question/ Share on other sites More sharing options...
BillyBoB Posted July 13, 2006 Share Posted July 13, 2006 [code]if $meta != "" {//do stuff}[/code] Link to comment https://forums.phpfreaks.com/topic/14516-basic-preg_match-question/#findComment-57487 Share on other sites More sharing options...
wildteen88 Posted July 13, 2006 Share Posted July 13, 2006 Use an if:[code=php:0]if(preg_match('!<meta name="name" content="(.*?)"/>!is', $contents, $meta)){ echo "A match was found!<br /><pre>" . print_r($meta, true) . "</pre>";}else{ echo "Now matchs found";}[/code] Link to comment https://forums.phpfreaks.com/topic/14516-basic-preg_match-question/#findComment-57489 Share on other sites More sharing options...
All4172 Posted July 13, 2006 Author Share Posted July 13, 2006 Wow, too simple LOL Thanks Link to comment https://forums.phpfreaks.com/topic/14516-basic-preg_match-question/#findComment-57491 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.