WesleyA Posted October 28, 2015 Share Posted October 28, 2015 (edited) There is an issue I have with creating a filter for the correct domain and toplevel domain. For example google.com is correct and all the other not. my code: function my_funct($data2) { $data2 = preg_replace('#(http://www.|http:|https:|ftp://www.|https://www./|//|www.|htp:|htt:|htp:/|htt:/|)# ' , '', $data2); return $data2; } but directories wil not be blocked like www.google.com/directory/page/page2 is there a way to use preg_replace and put only domain and toplevel domain in it? maybe it is possible to negate it, but he entire validation of pre_replace would be changed I assume. Edited October 28, 2015 by WesleyA Link to comment Share on other sites More sharing options...
WesleyA Posted October 28, 2015 Author Share Posted October 28, 2015 I was thinking like any character after the first / is that possible? Link to comment Share on other sites More sharing options...
WesleyA Posted October 28, 2015 Author Share Posted October 28, 2015 I found (.*) which works fine. Topic may be closed Link to comment Share on other sites More sharing options...
justsomeguy Posted October 28, 2015 Share Posted October 28, 2015 Look into the parse_url function if you're trying to parse a URL. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now