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

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -