Regular Expression Maximum Length
Good Morning! I have a regular expression set in my Display Form Validator text area box to limit the number of characters a user can enter to 250. I have the expression set to /^[a-zA-Z]{1,250}$/ however, when I enter "This is a test." into the text area, my error messages pops up. I'm very new to regular expression, does what I have look correct?
0
-
Hi Lisa,
I'm not a regular expresison expert, so there may be a better way to do this, but your expression is only allowing lowercase a to z, and uppercase A to Z, not spaces or a period. I just ran this through a regular expresison validator and your test sentance passed, so this may work for you:
/^[a-zA-Z .]{1,250}$/
This new expresison will allow spaces, and periods. Note the space and period after the capital Z in your character set.
I hope this helps!
Thanks,
Danny0 -
Thank you Danny! Once again you've saved the day! 0
Du måste logga in om du vill lämna en kommentar.
Kommentarer
2 kommentarer