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




My apologies, I just signed up for this list, so I can't preserve the
continuity of the thread.

The ILE C Runtime on IBM i follows the XBD specification for regular
expressions, defined here:
http://www.opengroup.org/onlinepubs/007908799/xbd/re.html

The problem with your regular expression is the use of the '\w' and '\W'
specifiers. These specifiers do not exist in the XBD regular expression
specification. If these specifiers are used like they are in PERL, '\w'
means any word character, and '\W' means any non-word character, so '[\w
\W]' would be equivalent to '.'. Alternatively you could use the character
class expressions (like [:alpha:] which would match any alphabetic
character). Here are two adaptations of your expression that would work on
IBM i:

"^(MDB)[-[:alpha:][:blank:]]*(Final.PDF|Final.pdf)$"
"^(MDB).*(Final.PDF|Final.pdf)$"

I hope that helps.

Aaron Albertson
IBM Rochester, MN 55901


Terrence Enger
<tenger@iseries-g
uru.com> To
Sent by: C programming iSeries / AS400
c400-l-bounces <c400-l@xxxxxxxxxxxx>
+sphanson=us.ibm. cc
com@xxxxxxxxxxxx
Subject
Re: [C400-L] RegExp I give up
07/22/2009 01:34
PM


Please respond to
C programming
iSeries / AS400
<c400-l@midrange.
com>






On Wed, 2009-07-22 at 08:04 -0700, Spencer Elliott wrote:
Hi,
I have the following regular expression:
^(MDB)[\w\W]*(Final.PDF|Final.pdf)$

I am familiar with \w as shorthand for [_A-Za-z0-9] and the web site you
cite below accepts space or hyphen and I know not what else for \W.
Anyway, the expression
[-A-Za-z0-9_ ]+
matches the middle part of your test input.


This expression test as true against the following string:
MDB MO3-09 Final.PDF
at http://www.regular-expressions.info/javascriptexample.html

I run the same expression and string through the iSeries RegExp APIs and
it fails(returns 1).

Does anyone have any idea where there is a online test that matches the
IBM APIs or can figure out what I am doing incorrectly?

Even a quick reference guide to the details on the iSeries would be a
help. I am sure I am just overlooking it, but it is frustrating to be
reduced to experimentation.

Cheers,
Terry.


BTW: The OCEAN conference was great!

My program works with another expression to test email addresses.
^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}$

Thanks,
Spencer


---snip---
/*---( Compile pattern )---*/
rc = regcomp(&preg, wrkPattern, REG_EXTENDED);
if (rc != 0) {
regerror(rc, &preg, errMsg, sizeof(errMsg));
PatError(100, (char *) pattern, (char *) errMsg);

regfree(&preg);

if (matchString != inpString) {
free((void *) matchString);
matchString = NULL;
}
return (0);
}

/*---( Run Pattern )---*/
if ( (rc = regexec(&preg, matchString, nmatch, pmatch, 0)) != 0 ) {
regerror(rc, &preg, errMsg, sizeof(errMsg));
---snip---


--
This is the C programming iSeries / AS400 (C400-L) mailing list
To post a message email: C400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/c400-l
or email: C400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/c400-l.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.