× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Buzz:

Using REGEX for this task is like using a sledgehammer to kill a fly. :-P

Mark S. Waterbury

> On 6/25/2013 9:20 AM, Buzz Fenner wrote:
In the past, I've utilized SK's, aka The Great One, nifty little utility
employing regular expressions within RPG. It's worked great for me up until
now. So I figure I'm overlooking something.


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.


Buzz Fenner

Business Systems Analyst/Systems Administrator

City Water & Light

870.930.3374 | 870.219.5229

bfenner@xxxxxxxxxxxxxxxx




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.