PHP Remove a string that starts with http:// or www and ends with .com/.ca/.net etc -
i found bunch of link show how delete within str_replace() want censor link on post. better, somehow detect when user trying post link , not let them submit form until remove it
i not sure write inside str_replace() or how check page inserted urls
any appreciated!
you'll want check submitted string against regular expression using preg_match().
preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $string)
Comments
Post a Comment