I've been playing around with my forms, well the validation of entered input. I've been using regular expressions to allow certain characters, but the more and more I push the code to the limits, the more I find weaknesses.
My intent is to stop/prevent malicious code, that code which could lead to vulnerabilities in the access of my data specifically in the database.
The problem is the more I go on, the more I figure out that actually writing a regular expression to permit certain characters etc gets more and more complicated.
Is there a way to go at this from a different angle maybe? Whilst I find many regular expressions out on the net in tutorials, when I push those, I generally find the same vulnerabilities in them as well, they have their gaps. Is it possible to use defence but also an offence in a way, in stead of going out saying what not to have, looking for things /combinations in particular?