I don't know if you're trying to balk at user-supplied information, or not, but just in case, I thought I'd rant for a minute.
I am thoroughly annoyed at any web form which gives me an error like the following:
Credit Card Numbers cannot contain spaces or dashes. Please enter your card number again in the proper format.
It makes me want to vote the rascals out, whenever an online tax form quibbles about dashes in government identifiers.
Your Social Security Number has three groups of digits, separated by dashes. To ensure your entry is correct, please re-enter your number in the format, ###-##-####.
I want to hang up on telephone systems when they whisper this nonsense in my ear:
Or conversely,You must first dial a One before your number. Please hang up, and dial your number again, beginning with a One, then your party's area code, then your party's number.
The security camera is the only thing stopping me from punching an ATM which requires me to enter the extra fraction zeros, when the machine is only equipped to dispense $20 bills.You do not need to dial a One before your number. Please hang up, and dial your number again, beginning with your party's area code, then your party's number.
Please enter the amout you wish to withdraw: $___.__ Your amount must be a multiple of $20.00.
If your system can accept the input as it is, then ACCEPT THE INPUT.
If your system can weed out the obviously extraneous information, then weed it out, and ACCEPT THE INPUT.
If your system can weed out the extraneous information, but it might not be what the user intended, then weed it out, and ACCEPT THE INPUT. In critical cases, confirm the input with an alternative display, and allow them to re-enter the information if it was interpreted incorrectly.
If your system can detect the difference between extraneous and possibly mistaken input, then show the user how your code interpreted their input, and ask for confirmation.
Days of the week? m,t, w-f You have entered: Monday Tuesday Wednesday Friday You may have entered something I don't recognize. Did I understand your schedule correctly? [ Yes ] No
Lastly, I have seen people try to associate 'H' for Thursday but never 'A' for Saturday. I don't think people will remember either one reliably, especially if they're not native English writers. Think of what your users want to see and specify, not what would fit in a single letter uniquely. These clever one-letter abbreviations should just be an implementation detail, not a user interaction plan.
Writing user interaction code is more labor-intensive on your part, and more demanding in terms of design consideration. However, you're going to foist any of these frustrations on each one of your users, every time they use it. In aggregate, that's a lot of frustration to dispense for just a few minutes of design time you save.
Be forgiving in what you accept, and strict in what you produce.
--
[ e d @ h a l l e y . c c ]
In reply to Re: Regex (lookahead) Confusion
by halley
in thread Regex (lookahead) Confusion
by ChrisR
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |