ted_chou12 Posted February 4, 2007 Share Posted February 4, 2007 I want a regex function to be able to recognize url strings and therefore I can automatically change them into url links, but I am very unexpeirenced with regex, can anyone help me out please? Thanks Ted Link to comment https://forums.phpfreaks.com/topic/37009-http-url-recognition/ Share on other sites More sharing options...
Orio Posted February 4, 2007 Share Posted February 4, 2007 So... What's the question? Orio. Link to comment https://forums.phpfreaks.com/topic/37009-http-url-recognition/#findComment-176814 Share on other sites More sharing options...
ted_chou12 Posted February 4, 2007 Author Share Posted February 4, 2007 I want a regex function to reconize url strings. thats basically it, sorry for not pointing it out at the first place. Ted Link to comment https://forums.phpfreaks.com/topic/37009-http-url-recognition/#findComment-176819 Share on other sites More sharing options...
Orio Posted February 4, 2007 Share Posted February 4, 2007 I am no regex expert, and I am sure there's a better way, but I think this isn't a bad regex for URLs: preg_match("/^(http:\/\/){0,1}[a-z0-9\-]+(\.[a-z0-9\-]+)+[\/]{0,1}$/i", ...); But I may have n00b's mistakes in it! (as far as I have tested it, it's good ) Orio. Link to comment https://forums.phpfreaks.com/topic/37009-http-url-recognition/#findComment-176846 Share on other sites More sharing options...
ted_chou12 Posted February 4, 2007 Author Share Posted February 4, 2007 thanks, ill take it. Ted Link to comment https://forums.phpfreaks.com/topic/37009-http-url-recognition/#findComment-176861 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.