[SOLVED]regex or escaping characters for safe display?
Posted: Wed Mar 15, 2006 3:42 pm
Just a quick question...
I understand how to test say username and login fields to make sure they are only alphanumeric using regex.
but
How do you allow a user to type anything they want and display it safely? Like in forums where users can type any alphanumeric character as well as any other keyboard character and have it displayed with no effect on the system.
Basically in a situation where you want to be flexible about user input.
Is this done with regex or are the non-alphanumeric characters escaped somehow or is it a combination of both methods?
cheers
rj
I understand how to test say username and login fields to make sure they are only alphanumeric using regex.
but
How do you allow a user to type anything they want and display it safely? Like in forums where users can type any alphanumeric character as well as any other keyboard character and have it displayed with no effect on the system.
Basically in a situation where you want to be flexible about user input.
Is this done with regex or are the non-alphanumeric characters escaped somehow or is it a combination of both methods?
cheers
rj