Hard/Easy Regular Expression help
Posted: Sat Jul 31, 2010 12:43 am
Hello Everyone,
I need help to get regular expressions to match urls in that way.
Used language: PHP
First One:-
(http:// only works with http protocol) (with www or without) (dot.) (domain name what ever it has numbers or chars) (dot.) (com|org|us etc...any domain extension is accept)(/ must have slash)(Numbers Only)(/ with ending slash or without)
examples:-
http://www.example.com/123123
http://example.us/41233/
http://www.example.info/41233/
The second one which I believe its hard to done:-
(http:// only works with http protocol) (with anything here numbers and chars www2 ww4 links etc ..) (dot.) (domain name what ever it has numbers or chars) (dot.) (com|org|us etc...any domain extension is accept)(/ must have slash)(foldername maybe having a folder name or not)(any-file-name.php?((url|link|redirect|go|anything=(what ever comes here)
examples:-
http://www.example.com/dir/red.php?url= ... xample.com
http://example.us/out.php?link=http://www.example.com
http://example.biz/go/to/dir/exit.php?h ... 8xMDc2NzA=
http://links.example.biz/go/to/dir/exit ... 8xMDc2NzA=
Your time and effort is much appreciated and I'm looking forward for your help.
Best Regards,
M.A.G
I need help to get regular expressions to match urls in that way.
Used language: PHP
First One:-
(http:// only works with http protocol) (with www or without) (dot.) (domain name what ever it has numbers or chars) (dot.) (com|org|us etc...any domain extension is accept)(/ must have slash)(Numbers Only)(/ with ending slash or without)
examples:-
http://www.example.com/123123
http://example.us/41233/
http://www.example.info/41233/
The second one which I believe its hard to done:-
(http:// only works with http protocol) (with anything here numbers and chars www2 ww4 links etc ..) (dot.) (domain name what ever it has numbers or chars) (dot.) (com|org|us etc...any domain extension is accept)(/ must have slash)(foldername maybe having a folder name or not)(any-file-name.php?((url|link|redirect|go|anything=(what ever comes here)
examples:-
http://www.example.com/dir/red.php?url= ... xample.com
http://example.us/out.php?link=http://www.example.com
http://example.biz/go/to/dir/exit.php?h ... 8xMDc2NzA=
http://links.example.biz/go/to/dir/exit ... 8xMDc2NzA=
Your time and effort is much appreciated and I'm looking forward for your help.
Best Regards,
M.A.G