match - Liquid Filter Reference
On this page
Description
Returns the items in the list, or characters in the string that match the supplied regex
| Property | Value |
|---|---|
| Return Type | list |
| Category | general |
Examples
liquid
{{ fruits | match: "/a/" | join: ", " }}
Output: apple, banana, date
liquid
{{ fruits | match: "/^[ad]/" | join: ", " }}
Output: apple, date
liquid
{{ "metamorphosis" | match: "/amo.*sis/" }}
Output: amorphosis
liquid
{{ "amorphosis" | match: "/(a)(m)(o)/" | join: ", " }}
Output: amo, a, m, o