in reply to When a regexp with /g needs to be run .. twice
If you are "cleaning up JSON," can you maybe use an existing Perl JSON implementation to read the existing data successfully? If the Perl library could be forgiving of what it sees and correct in how it interprets it, then you would have the data correct in-memory. Then maybe then you could use that library to then write-out a new JSON file that does conform to standards. This alternative approach, if successful, might be a great sight easier than the "cleaning up" approach that you are now attempting. Worth a try ...
|