BizTalk Posted March 7, 2007 Share Posted March 7, 2007 I have been trying to find the wild card search key for php.Remember back in dose if you did a dir images*.jpg, it would return all files named imagesXX.jpg I need to do something similar in php.Anyone know what the wild card is? Link to comment Share on other sites More sharing options...
ripken204 Posted March 8, 2007 Share Posted March 8, 2007 that would be so helpful. how about wild cards like when you start typing a word in and before you finish typing it, results are already showing up.like if you want to type "car" and youve only typed in "ca" so for, it would show "cat, car, cap, etc..." Link to comment Share on other sites More sharing options...
Chozo4 Posted March 10, 2007 Share Posted March 10, 2007 (edited) The wildcard in Regular Expression (used in functions like preg_match or preg_replace) would be a simple 'period'.Lets say you're seraching inside 'My dog is a lazy dog';'.' = Matches any single characterWould match 'M''.*' = Matches everything till the very end (greedy)Would match 'My dog is a lazy dog' (since no other match at end was indicated).However...'.*g' Would match 'My dog is a lazy dog' Since 'g' is the very last end match.'.*?' = Matches till it hits the first match (lazy)Would match 'My dog is a lazy dog' (since no other match at end was indicated).However...'.*?g' Would match 'My dog' due to 'g' being the first match of 'g'To further note:following a wildcard/match query with '*' means infinite matches till the endfollowing a wildcard/match query with '?' means match till the first matching textfollowing a wildcard/match query with '+' means it must match one or more timesIf this wasn't very clear - the php manual has more info regarding regular expressions.http://php.net/regexAs well as these other sites:http://weblogtoolscollection.com/regex/regex.phphttp://www.regular-expressions.info/php.html Edited March 10, 2007 by Chozo4 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now