d_barszczak Posted July 30, 2008 Share Posted July 30, 2008 Hi all, Once again i have been tripped up by regex so hope you can help. I have a hitcounter script that submits an id and the url of the page the script was run. I need to be able to detect a domain within the url i.e. // Check to see if site is registered. $domain = "integrateditsystems.co.uk"; $url = "http://www.integrateditsystems.co.uk/support"; if ($domain exists within $url) return true else false; // Help Me!! Quote Link to comment https://forums.phpfreaks.com/topic/117310-detect-a-word-within-a-string/ Share on other sites More sharing options...
lwc Posted July 30, 2008 Share Posted July 30, 2008 Why do you need regexp for this? Just use http://php.net/strpos And remember the opposite of "===" is "!==". Of course, if you just do what you want directly, it would also match "http://www.phishing.com/integrateditsystems.co.uk/trickedyou/". Quote Link to comment https://forums.phpfreaks.com/topic/117310-detect-a-word-within-a-string/#findComment-603566 Share on other sites More sharing options...
d_barszczak Posted July 30, 2008 Author Share Posted July 30, 2008 Hmm good point... I need to allow for sub domains so i could do something like "http://*.integrateditsystems.co.uk" or require a hitcounter for each sub domain. Will have to have a think about this then. Quote Link to comment https://forums.phpfreaks.com/topic/117310-detect-a-word-within-a-string/#findComment-603758 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.