LOG IN SIGN UP
Documentation

regsub()

Replaces the first occurrence of pattern, which may be a Perl-compatible regular expression, in input with replacement. If no match is found, no replacement is made. Calls to regsub do not set re.group.*.

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.

This function is not prefixed with the std. namespace.

Format

STRING
regsub(STRING input, STRING pattern, STRING replacement)

Examples

1
2
# The following example deletes any query string parameters 
set req.url = regsub(req.url, "\?.*$", "");