> I was playing with official substituteExamle.java code.
> I need to get everything between body tags, so expression I use is:
>
> <BODY\\s*(.*[\n])+?\\s*<\\/BODY>
>
> It works great as long as length of the string between body
> tags is less
>
> than 300 characters or so.
> As soon as it's longer than that I get java exception. It looks like
> infinite loop.
>
> Is that a well known BUG or my expression is wrong (then why would it
> work with short strings)?
Sounds like a bug - but your expression has some problems as well,
and a better expression might work around the bug. Try this:
<BODY[^>]*>\\s*(.+?)\\s*</BODY>
compile it with Perl5Compiler.SINGLELINE_MASK
The singleline mask will allow '.' to match '\n', which it normally
wouldn't.
- Dan