in reply to Re: Extract lines of .java
in thread Extract lines of .java

Or try Text::Balanced