How to use awk to do replacing with sub match?
I tried:
{
fss="FieldsFunc(s string, f bool)"
fss=gensub(/([( ])(.+?) .+?([,)])/,"\\1\\2\\3","g",fss); print fss;
}
and am expecting the output to be FieldsFunc(s, f), but I got FieldsFunc(s string, f). What I've done wrong? Thx.
g?awkdoesn't have support for lazniness. Ungreedy quantifiers are Perl specific. You could change your regex to some thing more restrictive: