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



Yes, the approach I tend to use, is to cache up to 10 expressions. And it
could be implemented into a utility procedure, with the caveat that one
would have to (rather, "should") remember to free associated space at end of
program. This important step may not be so easy for the developer to
remember, and no error will result if it's forgotten. In some designs, it's
very difficult even to accomplish.

I cannot see what's happening under the covers (wish I could - it'd be fun
to see how another might do it), so all I could do was raise questions. You
note I had no problem with that challenge. ;)

Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
No time spent with a cat on your lap, can ever be considered 'wasted.'

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-
bounces@xxxxxxxxxxxx] On Behalf Of Charles Wilt
Sent: Friday, August 13, 2010 8:54 AM
To: RPG programming on the IBM i / System i
Subject: Re: Regular Expressions

Dennis,

It would seem to me that your concerns could be simply addressed by
keeping track of the last expression REGCOMP'd and not doing the
REGFREE until the expression changes or the activation group ends.

In fact, if it we're me, I'd consider keeping a lookup table of
expressions and either the DS or pointers to dynamically allocated DSs
that REGCOMP uses.

That way you could have more than one regex "active" as it were.

Charles

On Fri, Aug 13, 2010 at 5:03 AM, Dennis Lovelady <iseries@xxxxxxxxxxxx>
wrote:
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.