blueman378 Posted March 2, 2008 Share Posted March 2, 2008 hi guys, well im modifying a file and it has this in it: $projectsListIgnore = array ('.','..','images'); what im also wanting to do is have it so it excludes any that start with "Copy of" so for example i have hello Copy of hello hello2 Copy of images another folder at the moment i would get hello Copy of hello hello2 Copy of another folder when what i acctually want is hello hello2 Copy of another folder get the idea? cheers matt Link to comment https://forums.phpfreaks.com/topic/93960-wildcard-in-aray/ Share on other sites More sharing options...
phpSensei Posted March 2, 2008 Share Posted March 2, 2008 I didn't quiet understand, but maybe this is what your looking for preg_replace('{^(Copy Of | copy of)}','',$string) Don't even know if thats good, I am pretty bad with regex Link to comment https://forums.phpfreaks.com/topic/93960-wildcard-in-aray/#findComment-481405 Share on other sites More sharing options...
blueman378 Posted March 2, 2008 Author Share Posted March 2, 2008 well basically there is some code which lists some prjects, based upon some directorys, andway it reads from this array $projectsListIgnore = array ('.','..','images'); and anything in that array is not printed basically, it works fine with static things but i need it to also not print anything that Starts with Copy of (backup folders and dont want them showing up) so im looking for something like $projectsListIgnore = array ('.','..','images','Copy of *); but obviously it doesnt work Link to comment https://forums.phpfreaks.com/topic/93960-wildcard-in-aray/#findComment-481412 Share on other sites More sharing options...
phpSensei Posted March 2, 2008 Share Posted March 2, 2008 then do this <?php $string = "Copy Of Folder"; $projectsListIgnore = array ('.','..','images'); $string = preg_replace('/^(Copy Of | copy of)(.+)/','',$string); ?> I guess the * you were looking for was (.+) using regex Link to comment https://forums.phpfreaks.com/topic/93960-wildcard-in-aray/#findComment-481414 Share on other sites More sharing options...
blueman378 Posted March 2, 2008 Author Share Posted March 2, 2008 thanks Link to comment https://forums.phpfreaks.com/topic/93960-wildcard-in-aray/#findComment-481421 Share on other sites More sharing options...
blueman378 Posted March 2, 2008 Author Share Posted March 2, 2008 btw where did the topic solved mod go? Link to comment https://forums.phpfreaks.com/topic/93960-wildcard-in-aray/#findComment-481423 Share on other sites More sharing options...
phpSensei Posted March 2, 2008 Share Posted March 2, 2008 btw where did the topic solved mod go? You know what, where did the site go itself? I keep trying to visit www.phpfreaks.com and it redirects me to the forums, weird things are going on with the updates. Topic Solved button was removed for the time being due to some update a while back. It should be back up soon, no worries Link to comment https://forums.phpfreaks.com/topic/93960-wildcard-in-aray/#findComment-481427 Share on other sites More sharing options...
blueman378 Posted March 2, 2008 Author Share Posted March 2, 2008 acctually they removed everything but the forums, try going to the tutorial section, its gone!!! thats what im pissed about aye but thanks Link to comment https://forums.phpfreaks.com/topic/93960-wildcard-in-aray/#findComment-481428 Share on other sites More sharing options...
phpSensei Posted March 2, 2008 Share Posted March 2, 2008 acctually they removed everything but the forums, try going to the tutorial section, its gone!!! thats what im pissed about aye but thanks Ya no problem, they also removed the logo up top. Link to comment https://forums.phpfreaks.com/topic/93960-wildcard-in-aray/#findComment-481431 Share on other sites More sharing options...
blueman378 Posted March 2, 2008 Author Share Posted March 2, 2008 lol that wasnt showing up for ages Link to comment https://forums.phpfreaks.com/topic/93960-wildcard-in-aray/#findComment-481436 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.