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) 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] 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
Archived
This topic is now archived and is closed to further replies.