remove_first

Remove only the first occurrence of a specified substring from the input string.

Syntax

{{ string | remove_first: substring }}

Example

{% assign text = "Dallas Metro Dallas" %}{{ text | remove_first: "Dallas " }}

Output

Metro Dallas

The remove_first filter deletes only the initial occurrence of a target substring within an input string, leaving subsequent duplicate occurrences intact. Unlike remove which wipes every match, remove_first targets only the first match.

In programmatic SEO landing pages, remove_first cleans up redundant brand prefixes in headline copy. For example: {{ row.headline | remove_first: row.brand_name }}. This strips duplicate brand prefixes from headings while preserving subsequent context.

Try this syntax in the editor.