in reply to Is it possible to use repetition within a Regular Expression Substitution?

^M? is that a literal Carriage Return? It might be more readable to use \r, \015 or \x0D instead.

And then there's "\-" which can be simplified to just "-".

Finally, "{40,40}" can be written as "{40}".

/^-{40}\r*$/