# [dc][1], Regex length 12
^[^# !]{59}$
This regular expression is simple enough that I don't think the flavor of regex matters -- it should work across the board. (Note the space after the # in the regex.)
I've tested all four flavors at regex101.com (PCRE/PHP, Javascript, Python, and Golang), as well as the Ruby version at rubular.com. The dc program matches the regex in all five regex versions.
-----
The dc program takes its input on stdin and puts its output on stdout.
Sample output for input 4 (there's a trailing space at the end of each line):
1 2 3 4
8 7 6 5
9 10 11 12
16 15 14 13
[1]: https://www.gnu.org/software/bc/manual/dc-1.05/html_mono/dc.html