catzilla Posted May 31, 2006 Share Posted May 31, 2006 why $output[2] = "yahoo-inc.c" instead of "yahoo-inc.com" ? thanks for answer in advance<?php$mail = "cc.yahoo-inc.com";preg_match('/(\w+\.*\w+\.)([\w|\-]+\.[aero|biz|cat|com|coop|info|jobs|mobi|museum|name|net|org|pro|travel|gov|edu|int])/i',$mail,$output);print_r($output);?># php tr7.php Array( [0] => cc.yahoo-inc.c [1] => cc. [2] => yahoo-inc.c) Quote Link to comment https://forums.phpfreaks.com/topic/10842-a-problem-with-preg_match/ Share on other sites More sharing options...
poirot Posted May 31, 2006 Share Posted May 31, 2006 [code]<?php$mail = "cc.yahoo-inc.com";preg_match('/(\w+\.*\w+\.)([\w|\-]+\.(aero|biz|cat|com|coop|info|jobs|mobi|museum|name|net|org|pro|travel|gov|edu|int))/i',$mail,$output);print_r($output);?>[/code]Should output:[code]Array( [0] => cc.yahoo-inc.com [1] => cc. [2] => yahoo-inc.com [3] => com)[/code] Quote Link to comment https://forums.phpfreaks.com/topic/10842-a-problem-with-preg_match/#findComment-40589 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.