> $a1="1,8,98,244,9,243,2,6,36,3,111,"; > > $a2="8,98,244,9,243,2,1,6,36,3,111,"; > > How can I exactly match "1," in both strings using one regular expression? > (first "1" is the first element and second time in a random position)?
if(preg_match('/(^|,)1(,|$)/',$str)) { echo "one is found"; } ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php