File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes regex between boundary tags Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "regex between boundary tags" Watch "regex between boundary tags" New topic

regex between boundary tags

Charles Knell

Joined: Mar 19, 2006
Posts: 25
I have a text file captured from a PL/SQL query. It contains 482 XML documents with identical structures. I'd like to merge these into a single document. The root element tag of each document is "<ROWSET>". I'm looking for a regular expression that will match "<ROWSET>[any number of characters here]</ROWSET>". The expression should match each of the 482 documents and not grab all the text between the opening <ROWSET> of the first document and closing </ROWSET> of the 482nd document.

Reading and muddling has not so far produced the results I want, so I'm asking for your help.

Alan Moore
Ranch Hand

Joined: May 06, 2004
Posts: 262
The simple answer is: If the documents are very large, you might find that regex to be too slow. Here's a faster version:
I agree. Here's the link:
subject: regex between boundary tags
It's not a secret anymore!