|
>I can have 2 routines it sounds like? You can have as many expressions as you need to identify the data. The first invoice format is the simplest, and least likely to give false positives. I went to http://www.sweeting.org/mark/html/revalid.php and used the following regular expression: X[A-Z]{2}\d{2}[A-Z]\d{3}L And ran it against the following text: INVOICE# XKC03J143L INVOICE # XTG05K023L INVOICE # XSC06A016L INV# XKC03G091L INV. XTC05L053L INV 5400960 INVOICES XTC05F008L AND XTC05F012L (in this case, I want to write 2 records) INVOICE XTC05F009L INVOICE #'S 2107071, 2107073 & 2107079 INVOICE #'S XSC04H008L & XTC04H021L And got the following: Match 1: XKC03J143L Match 2: XTG05K023L Match 3: XSC06A016L Match 4: XKC03G091L Match 5: XTC05L053L Match 6: XTC05F008L Match 7: XTC05F012L Match 8: XTC05F009L Match 9: XSC04H008L Match 10: XTC04H021L Then I ran this regex against the same text: /d{7} And got: Match 1: 5400960 Match 2: 2107071 Match 3: 2107073 Match 4: 2107079 Now, obviously, if someone puts a 7 digit number into the field that isn't an invoice number (say a phone # w/out any delimiters) it will still show up. For example, my phone of 6273800 would show up, however 627-3800 would not. However, 5166273800 will also show up. But, if you _know_ that you'll always have a space before and after the numbers you would expand the regex to: \b\d{7}\b And you'd only match 7 digit number, more than 7 digits and it wouldn't count. Obviously this is why the first invoice format is so much easier. Oh, now of couse, you need to figure out how to use regular expressions in RPG. <G> -Walden PS. That site isn't FF frieldly, so you'll have to use IE if you don't already. ------------ Walden H Leverich III Tech Software (516) 627-3800 x3051 WaldenL@xxxxxxxxxxxxxxx http://www.TechSoftInc.com Quiquid latine dictum sit altum viditur. (Whatever is said in Latin seems profound.)
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.