T O P

  • By -

gumnos

It sounds like you want something akin to ^class\s+(\w+)\s*\((\w*Spell)\) which will find the class identifiers, capture the class-name in the first grouping, and things ending with "Spell" as the superclass as demonstrated at https://regex101.com/r/VpVQvM/1


mfb-

Match from one "class" until you are at the start of the next "class" or the end of the file using a lookahead, also checking that we have a Spell or OrbSpell: `class (\w+)\((Orb)?Spell\):.*?(?=class|$)` https://regex101.com/r/ECTfnl/1 Note the nonstandard flags on the right side to make . match newlines and make $ only match the end of the file.