File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Imitating Java RegEx API in Java2 v1.2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Imitating Java RegEx API in Java2 v1.2" Watch "Imitating Java RegEx API in Java2 v1.2" New topic
Author

Imitating Java RegEx API in Java2 v1.2

Bob Robertson
Greenhorn

Joined: May 16, 2004
Posts: 17
Hello,

I am updating an application that is requiring me to write something that will match on the HTML element names in a JSP.

The goal is to exclude the dynamically generated elements in the result. The elements are built from a loop to present a list on the page. The logic is used to uniquely ID a selected element. The format of the elements are as follows:

elementName_i, where i can be 0-15.

Now, I can't leverage the REGEX API like I was hoping to where I could exclude those elements with a character sequence ending in "_i" where I could use the expression for 0-9. I am working with JDK 1.2.

Can someone recommend a solution that will get me started in the right direction?

I can write something that does String evaluations or something and muddle my way through it, but I would like to see if there is a more clean way to go about it.

Any hints would be appreciated.

br
David Harkness
Ranch Hand

Joined: Aug 07, 2003
Posts: 1646
If you can use an LGPL package, check out the GNU Regex Library. I haven't used it, but it's been around for ages, and it works with Java 1.1 and up. There's also an older Java 1.0 version still available.
Bob Robertson
Greenhorn

Joined: May 16, 2004
Posts: 17
Thank you for the insight, David. On a recommendation from a colleague, this is what was implemented. Please note, I am not totally happy with this resolution:

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Imitating Java RegEx API in Java2 v1.2