php preg_replace form validation?

seesoe

New member
im trying to use preg_replace to output the following situations.
only letters
only numbers
only letters and numbers
only letters numbers periods and commas

im trying also trim all white spaces, i guess i can use trim() unless there is a way i can use regex to trim all down in one function.

so far i got only numbers down
preg_replace("#[^0-9]#i",' ',$var)
thank you, the preg_replace got me started for tonight, so i can learn it more i will use it for now, tomorrow i will change the whole system over to filter_input_array, as i have 9 input fields i am trying to validate, looks easy and great to use, thanks:)
 
Back
Top