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.

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".

If pattern contains grouping characters ( or ), 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 std. namespace.

Format

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

Examples

1
set req.url = regsub(req.url, "?.*");