from django import template
import re
from django.utils.safestring import mark_safe

register = template.Library()


@register.filter
def highlight(text, word):
	pattern = re.compile('(%s)' % word, re.IGNORECASE)
	result = pattern.sub(r'<b>\1</b>',text)
	return mark_safe(result)


