How can I perform a RegEx match in Twig?
Currently Twig uses regular expressions only with Comparisons:

{% if string matches '{^[\d\.]+$}' %}
    Do Stuff
{% endif %}


Craft itself currently doesn't have any custom Twig filters or functions either.

But there are third-party plugins which might help you: 


Twig PCRE Filters
Low Regex