@aral It appears (in V8 at least) that there are two limits: one for the aggregate amount of space that all RegExps can take up on the heap of an isolate (https://github.com/v8/v8/blob/main/src/regexp/regexp.cc#L940-L955) and another for the size/depth when parsing. The former _seems_ to be 1MB for compiled and the latter at least has a test which fails at 20,000 "[1]"s but my quick looking didn't reveal a hard'n'fast limit (https://github.com/v8/v8/blob/main/test/mjsunit/regress/regress-1255368.js) I'm no v8 expert though, these may be useful pointers for where to dig
@chip Thanks, Chip. I did dig around a bit and saw similar references.

Bottom line: I really shouldn’t have been using a dynamically-generated regex for that part of the parser. Especially since I already have the start and end indices for the areas I want to replace. So I’m going to refactor with that approach.

Appreciate your taking the time to look into it and reply :)