Replace and Remove Filters for Scriptlets
Scriptlets allow you to easily replace or remove text from a string with filters. You may replace the first occurrence of a string with another string, or remove all occurrences of a string from the input text.
Replace Characters
Section titled “Replace Characters”replace
Section titled “replace”Replaces every occurrence of the first argument in a string with the second argument
{? "I've recieved the gift. Thank you 🎉" | replace: "recieve", "receive" ?}`{? "My favorite color is blue, her favorite color is red." | replace: "color", "colour" ?}`replace_first
Section titled “replace_first”Replaces only the first occurrence of the first argument in a string with the second argument
{? "My favorite color is blue, her favorite color is red." | replace_first: "color", "colour" ?}`Remove Characters
Section titled “Remove Characters”remove
Section titled “remove”Removes every occurrence of the specified substring from a string
{? "This is dummy xyz text xyz" | remove: "xyz" ?}remove_first
Section titled “remove_first”Removes only the first occurrence of the specified substring from a string
{? "This is dummy xyz text xyz" | remove_first: "xyz" ?}Removes all whitespace characters (newlines, tabs, spaces) from the left and right sides of a string
{? " World! " | prepend: " Hello " | strip ?}rstrip
Section titled “rstrip”Removes all whitespace characters from the right side of a string
{? "Hello! \t\n " | downcase | rstrip ?}lstrip
Section titled “lstrip”Removes all whitespace characters from the left side of a string”
{? "\t \n Hello!\n" | downcase | lstrip ?}strip_newlines
Section titled “strip_newlines”Removes all newline characters from the string
{? " \n Sentence 1 \nSentence 2! \t\n " | downcase | strip_newlines ?}