less fragile detection of end of config script CDATA