One key to creating a regex is to look at the data you want to match and describe it in a very elementary way, then translate that into a regex. If your description is "match one or more consecutive lines that each start with 9 spaces", your regex is /(^ {9}.*\n)+/m.