Is there an easy way to say "If this text field has a url, don't allow submission"?

I would like to have a feature that if the message contains a link the form gives out an error saying “This field cannot contain links” to avoid spam links.