It's not a secret anymore!
The moose likes Java in General and the fly likes Trouble crafting regular expression. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Trouble crafting regular expression." Watch "Trouble crafting regular expression." New topic

Trouble crafting regular expression.

Garrett Rowe
Ranch Hand

Joined: Jan 17, 2006
Posts: 1296
I'm having difficulty crafting a regular expression to suit my needs. I want a match that begins with a particular word and ends on the next occurance of that word (non - inclusive):

As I said the match should be non-inclusive so that the next call to find() would begin with the target word. Any thoughts?

[ April 26, 2006: Message edited by: Garrett Rowe ]

Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
Henry Wong

Joined: Sep 28, 2004
Posts: 20175



Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Garrett Rowe
Ranch Hand

Joined: Jan 17, 2006
Posts: 1296
Thanks Henry, works perfectly. The reluctant quantifyer was the part I was missing.
I agree. Here's the link:
subject: Trouble crafting regular expression.
It's not a secret anymore!