HI i am new to jinja2 and trying to use regular expression as shown below
{% if ansible_hostname == \'uat\' %}
{% set server = \'thinkingmonster.com\' %}
Jinja2 can quite easily do substr checks with a simple 'in' comparison, e.g.
{% set server = 'www.thinkingmonster.com' %}
{% if 'thinking' in server %}
do something...
{% endif %}
So your substring regex filter isn't required. However if you want more advanced regex matching, then there are in fact filters available in ansible - see the regex filters in http://docs.ansible.com/playbooks_filters.html#other-useful-filters - funnily enough, your match syntax above is nearly exactly right.
+1 for Bereal's answer though, it gives a nice alternative in the form of a map.