Replaces the first occurrence of
pattern, which may be a Perl-compatible regular expression, in
replacement. If no match is found, no replacement is made.
This function may fail to make a replacement if the regular expression recurses too heavily. Such a situation may occur with lookahead and lookbehind assertions, or other recursing non-regular expressions. In this case,
fastly.error is set to "EREGRECUR".
pattern contains grouping characters
re.group.<i> produces the ith group.
re.group.0 always evaluates to the text matched by regsub itself.
This function is not prefixed with the
STRING regsub(STRING input, STRING pattern, STRING replacement)
1 2 # The following example deletes any query string parameters set req.url = regsub(req.url, "\?.*$", "");