Detect ASCII-art windows made of M and S characters
Retina, 68 67 bytes

Byte count assumes ISO 8859-1 encoding.

S
M
^(M((M)*M)\2)((?&lt;-9&gt;¶M((?&lt;9-3&gt; )*(?(3)!)M|\5)\5)*(?(9)!)¶\1)\4$


Try it online!