|
I have a 20-character field (bank account) that needs to only contain blanks
or digits. In addition, the digits must be contiguous and right aligned.
Some examples are:
'12345678901234567890' (good)
' 67890' (good)
' #67890' (not good)
' 56789 ' (not good)
This is what I'm using for the pattern: '^[ ]*[0-9]+$'. I've also tried
coding it this way: '^\s*\d+$'. It works, mostly, but doesn't flag the last
example as a bad string. I would have thought the end-of-string anchor would
flag the string as bad, unless it stops checking after the digit '9' thereby
ignoring the space in the last position of the string.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.