Hi There

What would the regular expression be in order to detect if a string posted from a form (input box) contains an e-mail address or a web address.

I need to catch the string before it gets saved to the DB and remove the e-mail addresses and web addresses that people may enter on the form.

I am not clued up with regular expressions at all. From what I can gather, it would be something long the lines of "catch anything that has words after a space and words before a space on both sides of an @ sign". I would imagine that a web address would be something like "everything after [url]http://,[/url] anything that has a word immediately proceeded by a fullstop or immediately preceeded by a fullstop, etc."

Any help will be most appreciated.
Thanks

    For email:

    ^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$

    For Web addresses

    ^(http|https|ftp)\://([a-zA-Z0-9\.\-]+(\:[a-zA-Z0-9\.&%\$\-]+)*@)?((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\.[a-zA-Z]{2,4})(\:[0-9]+)?(/[^/][a-zA-Z0-9\.\,\?\'\\/\+&%\$#\=~_\-@]*)*$
      Write a Reply...