You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

I am having difficulty validating for white space in address lines

Summary:

I am trying to throw a warning when someone inadvertently puts two or more consecutive spaces in the address line. I also want to warn if they leave a space at the end of the string.

Content (please ensure you mask any confidential information):

I am able to successfully validate for special characters, but validation for spaces still eludes me. I have tried the recommendations from other posts as well as the following regxp expressions - none of these are working for me:

/[ ]/
/[ ]$/
/[ ]{2,}/
/^([ ]{2,}).$/
/^(?!.
[ ]{2,}).$/
/\s$/
/\s{2,}/
/^(\s{2,}).
$/
/^(?!.\s{2,}).$/

as you can see, I have two scenarios I am validating with "matches regxp" rule: consecutive spaces within the field (address line) as well as trailing space. I have a "does not match regxp" validation rule for special characters that works perfectly, so I assumed this would be a slam dunk. I just don't understand why none of these are working.

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!