I have a textarea form where you can insert URLs which are passed through a function. But I can't figure out how to secure it against malicious code.
I found a way to check valid characters with preg_match()
but since a URL can contain almost every character this isn't very useful.
Is there a way to check if the textarea only contains URLs or disable code execution all together?