millercj Posted April 28, 2010 Share Posted April 28, 2010 I'm trying to search a string for a certain syntax (to ultimately get the number of occurrences). I want to ignore spaces but I'm unsure of the best way to do that. Here is my code right now <?PHP $homepage = file_get_contents('http://www.legacy.com/obituaries/ldnews/obituary-browse.aspx?page=1&recentdate=0&entriesperpage=50'); $substring = '<div> <b>'; $substringCount = substr_count($homepage, $substring); echo $substringCount; another way I could accomplish what i'm trying to do is if there's a way to search for text that includes a wild card such as Taglist2Alpha, where the number is the wildcard something similar to $substring = 'Taglist*Alpha'; Quote Link to comment https://forums.phpfreaks.com/topic/200050-search-string-ignoring-spaces/ Share on other sites More sharing options...
Ken2k7 Posted April 28, 2010 Share Posted April 28, 2010 Check out preg_match and preg_match_all. Quote Link to comment https://forums.phpfreaks.com/topic/200050-search-string-ignoring-spaces/#findComment-1049974 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.