bird_man11 Posted September 20, 2007 Share Posted September 20, 2007 Hi guys, i have an array that i want to search for example $aacnbri = array("D99992001", "D00231119", "D99992100", "D00129123"); the first character is known and the last 4 digits are known, but the middle 4 arn't known i was wondering how would i go about this, is there any way of using array_search() or in_array() with a wildcard? e.g "D****2001" cheers Link to comment https://forums.phpfreaks.com/topic/70074-array-wild-card-search/ Share on other sites More sharing options...
Jessica Posted September 20, 2007 Share Posted September 20, 2007 I think you'll have to use regular expressions for this. Link to comment https://forums.phpfreaks.com/topic/70074-array-wild-card-search/#findComment-351932 Share on other sites More sharing options...
bird_man11 Posted September 21, 2007 Author Share Posted September 21, 2007 yeah i have tried using in_array('/D[0-9]{4}2001/', $aacnbri); and array_search('/D[0-9]{4}2001/', $aacnbri); but they do not seem to work, i will just have to loop the array and use preg_match() thanks Link to comment https://forums.phpfreaks.com/topic/70074-array-wild-card-search/#findComment-351941 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.