From gawk manual
Because some built-in functions (e.g.
match,split,sub) accept regexp constants as arguments, confusion can arise when attempting to use regexp constants as arguments to user-defined functions. For example:function mysub(pat, repl, str, global) { if (global) gsub(pat, repl, str) else sub(pat, repl, str) return str } { ... text = "hi! hi yourself!" mysub(/hi/, "howdy", text, 1) ... }In this example, the programmer wants to pass a regexp constant to the user-defined function
mysub(), which in turn passes it on to eithersub()orgsub(). However, what really happens is that thepatparameter is assigned a value of either one or zero, depending upon whether or not$0matches/hi/. gawk issues a warning when it sees a regexp constant used as a parameter to a user-defined function, because passing a truth value in this way is probably not what was intended.
- How can I pass a regular expression constant as an argument to a function, so that the function can receive the argument as a regular expression instead of a truth value? - In other word, before a regular expression constant is passed into a function, how can I prevent it from being evaluated as a string matching expression, and ensure it being treated as what it is? 
- How can regular expression constants be passed to those builtin
functions (e.g. match,split,sub) as regular expressions, without being evaluated as a string matching expression?
Thanks.

mysub("hi", "howdy", text, 1).