<div class="filter-replace filter-body">
  {% import 'includes/filters/filter-variables.j2' as vars %}

  <p class="doc">
    {% with key='Replace-data-filter' %}{% include "includes/help.html" %}{% endwith %}
    Replace values in the dataset.
  </p>

  {% include 'includes/filters/label-field.html' %}

  {% set name='replace-pattern%02d' % n %}
  <div class="form-group required">
    <label for="{{ name }}">
      Text or pattern to replace
    </label>
    <input
        id="{{ name }}"
        class="form-control"
        required="required"
        name="{{ name }}"
        value="{{ recipe.args[name] }}"
        placeholder="text to replace"
        />
  </div>

  {% set name='replace-regex%02d' % n %}
  <div class="checkbox">
    <label>
      <input
          type="checkbox"
          name="{{ name }}"
          {% if recipe.args[name] %}
          checked="checked"
          {% endif %}
          />
      Use a regular expression pattern.
    </label>
  </div>

  {% set name='replace-value%02d' % n %}
  <div class="form-group">
    <label for="{{ name }}">
      Replacement text
    </label>
    <input
        id="{{ name }}"
        class="form-control"
        name="{{ name }}"
        value="{{ recipe.args[name] }}"
        placeholder="text to replace"
        />
  </div>

  {% set name='replace-tags%02d' % n %}
  <div class="form-group">
    <label for="{{ name }}">
      Replace only in these columns
    </label>
    <input
        id="{{ name }}"
        class="form-control"
        name="{{ name }}"
        value="{{ recipe.args[name] }}"
        pattern="^{{ vars.filters_pattern }}$"
        title="{{ vars.filters_help }}"
        placeholder="{{ vars.filters_placeholder }}"
        />
  </div>

  {% set name='replace-where%02d' % n %}
  <div class="form-group">
    <label for="{{ name }}">
      Replace only in rows matching this query
    </label>
    <input
        id="{{ name }}"
        class="form-control"
        name="{{ name }}"
        value="{{ recipe.args[name] }}"
        pattern="^{{ vars.query_pattern }}$"
        title="{{ vars.query_help }}"
        placeholder="{{ vars.query_placeholder }}"
        />
  </div>

</div>
