<p>I need to do a lot of searches of certain patterns in source files while the user is changing them, so I need to do regexp matching that is efficient in time and memory. The pattern repeats itself so should be compiled once, but I need to be able to retrieve subparts (rather than just confirm a match)</p>

<p>I'm considering using java.util.regexp or the Jakarta perl5util (if it still exists, been a few years since I used it), or perhaps the Eclipse search engine though I doubt that ti's smarter. </p>

<p>Is there any significant performance difference between the two?</p>

I am not sure there is a huge performance gap in term of the different regexp java engines.
But there sure is a performance issue when constructing a regexp (and that is, if the data is large enough, as
noted by Jeff Atwood
)
The only thing you should avoid is
catastrophic backtracking
, better avoided when using
atomic grouping
.
So, by default I would use the java.utils.regexp engine, unless you have specific perl-compliant sources of regexp you need to reuse in your program.
Then I would carefully construct the regexp I intend to use.
But in term of choosing one engine or another... as it
has been
said
in
many
other questions
...:
"make it work, make it fast - in that order"
beware of "premature optimization".