× 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.



Thank you for your responses, John. While I don't see the benefit of using
one individual's API under the conception that another's API is difficult to
learn/use, I salute you making this available. I am not some other person,
and this may exactly fit that other person's needs!

But I did notice that you avoided the performance question. I'm just
saying. :)

Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
"For a moment, nothing happened. Then, after a second or so, nothing
continued to happen."
-- The Hitchhiker's Guide to the Galaxy


I had three objectives for producing this implementation.

The first objective was to use a single call instead of REGCOMP,
REGEXEC
and REGFREE.. This is closer to the "standard" implementation found in
other
languages and scripts. It also makes regular expressions more
accessible to
those who are unfamiliar with the IBM api's.

My second objective was to remove the confusion / ambiguity caused
by
differing character sets / ccsid's. While I cannot guarantee that my
implementation will work successfully across all the character sets /
ccsid's, it is more robust than the IBM-supplied api's.

My third objective was to widen the range of regular expressions
available here. Allied to this was the need to improve the
documentation
for RPG developers.

Two of the examples illustrate a return position rather than 1
(alpha, h
and alp25a, \d, both of which return position 4).

Messages which can be of help in determining whether a regular
expression is valid or not can be obtained from the return code. A
negative
return code (range -1 to -18) will indicate the message based on the
IBM
documentation. These return codes are in the readme, which can be
viewed on
line.

I agree with you in that "the hard part is in coming up with the
right
expression". This is the case in all implementations of regular
expressions. Different implementations use different (albeit very
similar)
syntaxes and there is a set of standard escape characters and
punctuation
characters.

I had considered an implementation of REGEXEC on its own, but this
cannot be done without a related implementation of REGCOMP. If you
think
this to be useful, I will look at it again.


Regards,
John McKay mba

----- Original Message -----
From: "Dennis Lovelady" <iseries@xxxxxxxxxxxx>
To: "'RPG programming on the IBM i / System i'" <rpg400-l@xxxxxxxxxxxx>
Sent: Friday, August 13, 2010 10:03 AM
Subject: RE: Regular Expressions


Thanks, John. I've seen implementations like this before (but not
public
domain). I cannot download and restore a save file to the systems I
access,
so there is conjecture here. That conjecture can be solved by having
a
FAQ
for the product. I presume that you're doing REGCOMP, REGEXP,
REGFREE
with
each operation. Have you measured the performance of this against
the
alternative (REGCOMP at the beginning of a process, REGEXP for each
of x
million rows/columns/whatevers, REGFREE at the end?

My studies on this (which I unfortunately cannot share) suggest that
one
would be much better off using REGCOMP and REGFREE themselves, rather
than
taking such a generic approach. After all, the hard part isn't in
calling
those expressions or evaluating their results; the hard part is in
coming
up
with the right expression, and that remains a hurdle with your
approach.

In other words, what is the value-add that may be traded for
performance?

Your examples, when they find a match, find them in position 1, and
return
a
1. What happens if a match is found in position n?

When one makes a mistake with a regular expression, what help
(optional or
otherwise) does the function return?

Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
"Better to remain silent and be thought a fool than to speak out and
remove
all doubt."
-- Abraham Lincoln



Single function regular expressions - regexp - now available for
free
at www.rpglanguage.com/regexp

Regards,
John McKay mba
--
This is the RPG programming on the IBM i / System i (RPG400-L)
mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.


--
This is the RPG programming on the IBM i / System i (RPG400-L)
mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.


--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.