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.

Thank you, gentlemen, for the assistance. I shall memorize these lines and hopefully store this tidbit in my brain for later. I think I had four miles of code to get rid of any possibly funky punctuation characters... all error-ridden.