Scooby08 Posted August 18, 2010 Share Posted August 18, 2010 I'm trying to figure out how to put this preg_match line into one: if (preg_match('/<meta name="keywords" content="(.*)?">/im', $file, $match) || preg_match('/<meta name="keywords" content="(.*)?" \/>/im', $file, $match)) { The difference is the closing part of the tag.. either this: > or this: /> How would I do an either or on that part? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/211114-how-to-put-these-two-preg_matches-into-one/ Share on other sites More sharing options...
salathe Posted August 19, 2010 Share Posted August 19, 2010 /<meta name="keywords" content="(.*)?"(?: \/)?>/i Quote Link to comment https://forums.phpfreaks.com/topic/211114-how-to-put-these-two-preg_matches-into-one/#findComment-1101122 Share on other sites More sharing options...
.josh Posted August 20, 2010 Share Posted August 20, 2010 /<meta name="keywords" content="([^"]*)"[^>]*>/i Quote Link to comment https://forums.phpfreaks.com/topic/211114-how-to-put-these-two-preg_matches-into-one/#findComment-1101742 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.