matches

Performs a match (including RegExp). Returns the value if matches, otherwise throws an exception

Input
  • {% assign user = "John Smith" %}
    {% assign result = user | matches: '^John Smith$' %}
    {%if result == user %}Hello {{ user }}!{% endif %}
    
Output
  • Hello John Smith!