I applied one of the rexex expressions you suggested there (this one: ([A-z,0-9]){20} ) but it didn't work. I am no regex expert, but I have just been reading up on it for a couple hours and I think your syntax may be incorrect. I think it should have been this instead(?):
[A-z0-9]{0,20}
or maybe even(?):
^[A-z0-9]{0,20}$
But that doesn't work either. Actually, I have also tried to do all of the following, to no avail:
-What is running the validation? PHP or JavaScript? Does it matter (I read that regex syntax may be different)? -Are the ^ at beginning and $ at end required? -Is the dot (.) wildcard recognized in this implementation of regex (again, depending on what is doing it, I read that it may or may not be recognized)? -Or I completely barking up the wrong tree? I may know just enough about this to be dangerous. lol
What I am trying to do is limit the field length to 20 characters (any character). I will be importing the data into my accounting software and that is the limit for this field. I figured better to catch it while filling out the form and get an error message than to have some characters chopped off somewhere later during the import process.
I tried ^[A-z,0-9]{0,255}$ for some text fields that are mapped to fields in Salesforce that have a 255 character limit. When testing the form it acts as though I've gone over the limit even if I've only entered one character. I tested the from in IE and Chrome.
I'm realizing now that it did work when I entered one character (or one word) in the field, but didn't work when there were any spaces in the text. I should have more paid attention when testing. Your example has the same limitation with the space character. I've changed mine to "^.{0,255}$" now. It works with the space character in the response text. That should take care of it.
I am getting an error using ^[A-z,0-9]{0,255}$ and I believe it is because the applicants are using / and other characters not a number or alpha. How do I account for that?