Rule 0 is just 8..11.
Rule 8 is just 42, or 42..8 => so just 42 repeated any number of times.
Rule 11 is 42..31 or 42..11..31. So in other words, 11 = 42..31 | 42..42..31..31 | 42..42..42..31..31..31| etc - i.e. 42 n times, then 31 that same number of times.
So rule zero is therefore
42{1,}..42{m}..31{m}
therefore
42{n}..31{m} where n >= m+1
first resolve all the other rules (or at least 31 and 42, which probably involves resolving the others) to regexes, then
for each line, keep matching 31 at the end, keep track of how many times you have matched 31, and if the remainder matches 41 that many times + 1, you have a match.
private static bool IsMatch(string line)
{
string wip = line;
int end31s = 0;
while(true)
{
string newwip = Regex.Replace(wip, $"{rule31}$", "");
if(newwip != wip) end31s++;
else return false;
if(Regex.IsMatch(newwip, $"^{rule42}{{{end31s+1},}}$")) return true;
wip = newwip;
}
}