Dec 5, 2001, 9:59 PM
Post #1 of 5
I need to verify data as input into a form field.
limit and replace characters
The criteria is: any alphabetical letter, numeral, the dash or the underscore character is OK FINE - but periods, symbols, leading or trailing whitespace, and other punctuation must be removed (stripped out totally leaving valid characters only)
so: "ab-cd_ef" would be OK as is
but: " Ab._@c,D. -!'ï_g1" would become "ab_cd-ef_g1" (lower case)
whitespace between characters would be replaced with an underscore _ , but leading or trailing whitespace would be stripped totally
so: "ab cd" woud become "ab_cd"
and to make it trickier - the first and last characters cannot be anything other than a numeral or alpha character -
so: "_abcd123-" even though it contained all valid characters, would need to become "abcd123"
I admit - this is way over my head. I appreciate all assistance and explanations so I might learn something from this little problem.