std.replaceall
Available inall subroutines.
Replaces all occurrences of the literal string target
in string s
with
replacement
. If no matches are found, no replacements are made. If target
is the empty string, the original string s
is returned.
Once a replacement is made, substitutions continue from the end of the
replaced buffer. Therefore, std.replace("aaa", "a", "aa")
will return a
string "aaaa" instead of recurring indefinitely.
Example
set req.url = std.replaceall(req.url, "+", "%2520"); # "+" is not a special character
User contributed notes
BETADo you see an error in this page? Do have an interesting use case, example or edge case people should know about? Share your knowledge and help people who are reading this page! (Comments are moderated; for support, please contact support@fastly.com)