--- url: https://developer.youcan.shop/themes/filters/strings/replaceLast.md --- # Replace Last Replaces the last occurrence of a substring in a string. ```liquid {{ string | replace_last: substring, replacement }} ``` ## Example ```liquid {{ 'red-blue-red' | replace_last: 'red', 'green' }} ``` ::: tip Output ```html red-blue-green ``` :::