sandy1028 Posted January 10, 2013 Share Posted January 10, 2013 ntv.com/very-own/ ntv.com/business/ ntv.com.wid-prl.com/very-own/ ltv.com/very-own/ Please tell me how to write a single regex which matches all the above conditions. Quote Link to comment https://forums.phpfreaks.com/topic/272959-url-regex/ Share on other sites More sharing options...
cpd Posted January 10, 2013 Share Posted January 10, 2013 Read the manual. I wouldn't really call them conditions and if you're looking for those 4 only why not create an array containing all 4 and test if your $variable is in that array. Quote Link to comment https://forums.phpfreaks.com/topic/272959-url-regex/#findComment-1404738 Share on other sites More sharing options...
Christian F. Posted January 10, 2013 Share Posted January 10, 2013 http://tinyurl.com/kqb7w <- All the information you'd ever need to write your own RegExp. Give it a go, and if you get stuck please post what you've got and we'll be able to help you out. Quote Link to comment https://forums.phpfreaks.com/topic/272959-url-regex/#findComment-1404743 Share on other sites More sharing options...
haku Posted January 14, 2013 Share Posted January 14, 2013 ntv.com/very-own/ ntv.com/business/ ntv.com.wid-prl.com/very-own/ ltv.com/very-own/ Please tell me how to write a single regex which matches all the above conditions. You didn't tell us any conditions. You just gave us four examples of text that I'm assuming is supposed to be caught by the regex. You need to tell us the conditions before we can help. Showing us anything you've tried would be nice as well. Quote Link to comment https://forums.phpfreaks.com/topic/272959-url-regex/#findComment-1405576 Share on other sites More sharing options...
.josh Posted January 22, 2013 Share Posted January 22, 2013 Here you go... preg_match("~.*~",$url,$match); Quote Link to comment https://forums.phpfreaks.com/topic/272959-url-regex/#findComment-1407487 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.