I want to SET a number of envars with a Regex that describes strings that will be passed correctly as arguments to functions and the like.
When passing envars around, to and fro subroutines, unquoting, changing and requoting again, things can go wrong. Sometimes there is quite a "distance" between the point when a mistake caused a malformed string and the moment that the error actually shows itself. By using a SET /T:regex:"..." I hope to catch those mistakes earlier.
I already tested the regex outside of TC and reads as follows in Perl notation.
In short it says: the whole string is acceptable if it matches an (unquoted string that contains no space, tab or commas) or (a quoted string). I know improvements are possible but I'll cross that bridge after solving this riddle.
At this point I'm stuck because I can't find the right combination of back-ticking, quoting, escaping and SETDOS expansion to get TC to swallow it.
I keep getting "Parameter error".
I have attached a test-driver and test-cases. Enjoy.
Any insights?
I pray this is not something trivial.
When passing envars around, to and fro subroutines, unquoting, changing and requoting again, things can go wrong. Sometimes there is quite a "distance" between the point when a mistake caused a malformed string and the moment that the error actually shows itself. By using a SET /T:regex:"..." I hope to catch those mistakes earlier.
I already tested the regex outside of TC and reads as follows in Perl notation.
Code:
^([^\s,"]+|"[\w\s,]+")$
In short it says: the whole string is acceptable if it matches an (unquoted string that contains no space, tab or commas) or (a quoted string). I know improvements are possible but I'll cross that bridge after solving this riddle.
At this point I'm stuck because I can't find the right combination of back-ticking, quoting, escaping and SETDOS expansion to get TC to swallow it.
I keep getting "Parameter error".
I have attached a test-driver and test-cases. Enjoy.
Any insights?
I pray this is not something trivial.
