Thank you for helping with this.
> Try replacing (.*) with ([^>]*).
You're suggestion does work in this situation. The only thing when a
where clause is added it can create a problem:
<for z in (select * from dual where 1>2) loop>
A few things crop up which make this hard such as:
<for z in (select * from dual where (1>2 or 2=2) ) loop>
The input could be shorted without the word "loop" if it's easier:
<for z in (select * from dual where (1>2 or 2=2))>
I was thinking a negative lookahead might work...still having issues.