in reply to Extract lines of .java

he only way to end the search is to use the ultimate closeing brace. Perhaps using increment and decrement on 1st open and last close braces?

You could use a recursive regex. Easiest way to get one is Regexp::Common.

use Regexp::Common; $_ = q{ public void readExternal() { this { is } not { { real } java } code but an { { { example } } } } }; my ($function) = /( public \s+ void \s+ readExternal [^{]+ $RE{balanced}{-parens=>' +{}'} )/x;

- Yes, I reinvent wheels.
- Spam: Visit eurotraQ.

Replies are listed 'Best First'.
Re: Re: Extract lines of .java
by steves (Curate) on Jan 02, 2003 at 18:27 UTC