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



Not for someone familiar with regular expressions. The () is used for extraction and back references.

ie.

^sid\((*.)\)*.$

In the outer parens are escaped and therefore actual parens.
The inner parens surround all characters between the actual parens, but more importantly, extract that value and make it available in the form of $1 in the expression (a back reference) and in the API can be returned.

So, matching the string "sid(12345)nananabooboo" would return 12345 in the back reference.

On 05/06/2010 08:40 AM, Rick.Chevalier@xxxxxxxxxxxxxxx wrote:
Dennis,

Sorry for the delay, been out the past couple of days.

My use of the parenthesis came from a couple of things. They were described as grouping characters together which made me think I needed them to identify the .xml as a group I wanted to match. Couple that with all the examples I found of using $ only matched the last character of a string. I didn't see any where it matched a group of characters at the end.

I left them in the expression because I felt it made the statement more readable for someone coming behind me. It seems more intuitive to have (.xml)$ than .xml$ in the pattern.

Rick

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Dennis Lovelady
Sent: Monday, May 03, 2010 3:07 PM
To: 'RPG programming on the IBM i / System i'
Subject: RE: File name regular expression

Thanks Dennis. That was it. I kept the original expression and just
inserted a * after [A-Z0-9].

I have a question (or two) about your expression.

1) I re-read the wikipedia site and I get the * after [A-Z0-9], but I
don't get the * at the end. Shouldn't that be $ to look for .xml at
the end of the name?

Glad to help. Yes, that splat was a typo.

2) If the parenthesis are removed does ^ and $ still match the pfi_
and .xml strings respectively or just a single character?

Breaking this down: ^pfi_

String must begin with pfi_. Nothing can precede the p, f must follow the p, ...
Same with the $ - the characters xml (in that order) must end the string.

I am not sure what you read that led you to believe the parentheses were doing you some service. I will be happy to address and/or attempt to interpret (translate) the phrase that led you that direction, if you can find it.

Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
"The only kind of love that makes a lifetime Into a life well lived, The only kind of love that ever fills you, Is the love you give."
-- David Wilcox



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



Privileged and Confidential. This e-mail, and any attachments there to, is intended only for use by the addressee(s) named herein and may contain privileged or confidential information. If you have received this e-mail in error, please notify me immediately by a return e-mail and delete this e-mail. You are hereby notified that any dissemination, distribution or copying of this e-mail and/or any attachments thereto, is strictly prohibited.


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.