match filter

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
import re

from django import template

register = template.Library()

@register.filter
def match(value, regex):
    """Usage: {% if value|match:"regex" %}"""
    return re.match(regex, value)

More like this

  1. location context_processor by gsf0 3 years, 9 months ago
  2. Single Django App behind multiple Apache Proxies by chadmaine 6 years ago
  3. Slightly better media path tag by ubernostrum 6 years, 1 month ago
  4. simple string formatting filter by gsf0 5 years, 8 months ago
  5. Flatpage Suggester Template tag for 404 templates by bradmontgomery 3 years, 3 months ago

Comments

(Forgotten your password?)