in reply to Shorthand for /^\s*abc\s*$/ ?

Thanks very much Athanasius and AppleFritter, dynamically building the regexes was the piece of inspiration I was missing :)