Hi,
You can also consider using island parsing, this very cool addition to PetitParser developed by Jan:
beginScript := '<script>' asParser.
endScript := '</script>' asParser.
script := beginScript , endScript negate star flatten , endScript ==> #second.
islandScripts := (script island ==> #second) star.
If you apply it on:
code := 'uninteresting part
<script>
some code
</script>
another
uninteresting part
<script>
some other
code
</script>
yet another
uninteresting part
'.
You get:
islandScripts parse: code
==> "#('some code' 'some other
code')"
Quite cool, no? :)
Doru