How to exclude placeholders enclosed in single or double curly brackets in HTML files?

I'm trying to define text enclosed in single or double curly brackets in an HTML file as placeholders. For example.

<p>Do not translate this {{ variable }} and don't translate that { variable } either.</p>


The following expression works fine Notepad++, but it doesn't work in SDL Studio.

\{+[^}]+\}+


1. Why doesn't the expression work?

1. What regex flavor(s) does SDL Studio support?

Parents Reply
  • The file is apparently a Shopify Liquid template file. Here's an example taken from the official website:

    https://shopify.github.io/liquid-code-examples/example/call-to-action

    {%- if cart.item_count > 0 -%}
    
    <form action="/cart" method="post">
    
      {%- for item in cart.items -%}
        <a href="{{ item.url | within: collections.all }}">
          <img src="{{ item | img_url: '200x200' }}" alt="{{ item.image.alt | escape }}">
          {{ item.product.title }}
        </a>
    
        {%- unless item.variant.title contains 'Default' -%}
          <p>{{ item.variant.title }}</p>
        {%- endunless -%}
    
        {%- assign property_size = item.properties | size -%}
        {%- if property_size > 0 -%}
          <ul>
    
            {%- for p in item.properties -%}
              {%- assign first_character_in_key = p.first | truncate: 1, '' -%}
              {%- unless p.last == blank or first_character_in_key == '_' -%}
                <li>
                  {{ p.first }}:
    
                  {%- if p.last contains '/uploads/' -%}
                    <a href="{{ p.last }}">{{ p.last | split: '/' | last }}</a>
                  {%- else -%}
                    {{ p.last }}
                  {%- endif -%}
    
                </li>
              {%- endunless -%}
            {%- endfor -%}
    
          </ul>
        {%- endif -%}
    
        <p>
          <a aria-label="Remove {{ item.variant.title }}" href="/cart/change?line={{ forloop.index }}&amp;quantity=0">Remove</a>
        </p>
      {%- endfor -%}
    
      <input type="submit" name="checkout" value="Checkout">
    </form>
    
    {%- else -%}
      <p>The cart is empty. <a href="/collections/all">Continue shopping</a></p>
    {%- endif -%}


Children