Factored out repeated regex into script variable
Added support for hy