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



Perl and Java both use NFA Engine Type ( Nondeterministic Finite Automaton
/cough ) so they are indeed a very similar flavour as far as what
functionality is available, although of course they are implemented through
the language quite differently - In Perl, regular expressions are a
first-class low-level feature of the language whereas in Java you would use
regular expressions via objects and methods...

The support built into DB2 for regular expression is also NFA and so I'm
finding pretty consistent behaviour between Java, DB2 and Perl for general
regex use.

If you haven't seen the DB2 support, you can use the predicate regexp_like
and functions such as regexp_count, regexp_instr, regexp_replace and
regexp_substr.

I threw up a simple test screen that I use to check how DB2 will work with
my regular expressions - here is how you can code a couple of them in RPGLE:

Exec SQL
Set :Scn_Match :ExtrInd
= regexp_replace( :DataStr,
:RegExp,
:ReplaceExp,
:Scn_FromPos, //‚Scan from Pos 1
:Scn_RepOccur, //‚Occurrance to replace 0 = all
:Flags //‚Use enhanced EOL match
);


Exec SQL
Set :Scn_Match :ExtrInd
= regexp_substr( :DataStr,
:RegExp,
:Scn_FromPos,
:Scn_MchOccur,
:Flags ,
:Scn_MchGroup
);

I'll stop now - I'm even boring myself!

On 15 April 2016 at 12:17, Buck Calabro <kc2hiz@xxxxxxxxx> wrote:

On 15 April 2016 at 06:58, Craig Richards <craig@xxxxxxxxxxxxxxxx> wrote:

Having read through Jeffrey Friedl's most excellent book "Mastering
Regular
Expressions" I guess I was thinking from some of the Perl examples, as
Perl
has regular expressions a bit more built into the language.

A very nice recommendation, thanks for this.

The regex provider in RDi is (mostly) the Java regex. If Lpex exposed
a hook for the regex provider I would switch to the Perl regex in an
instant! This isn't a slam on the choice made by the RDi team -
Eclipse is made by and for Java programmers. It's (dare I say it?)
rational (hee hee) that RDi uses the Java regex. But I personally
prefer the Perl regex... Preferences, preferences, preferences. :-)
--buck
--
This is the Rational Developer for IBM i / Websphere Development Studio
Client for System i & iSeries (WDSCI-L) mailing list
To post a message email: WDSCI-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/wdsci-l
or email: WDSCI-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/wdsci-l.


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.