Couldn't you add an optional option to the generic parser like the "forceUTF8Encoding" so that the matcher behaves the described way?
Implementing a duplicate of the generic parser so that 10 lines are changed (one more loop for parse, categories, subcategories) could lead to future incompatibilities ...
not needed, I just figured it out:
put
(?<!class=2.*)(?<=class=1.*) before your regex, and only the matches between "class=1" and "class=2" will match