Pyjo.Regexp - Compile regexp pattern into object

from Pyjo.Regexp import r

re_words = r('(\w+) AND (\w+)', 'i')

m = re_words.search('This and that')
if m:
    print('{0} + {1}'.format(*m.groups()))

Pyjo.Regexp provides factory function which compiles regexp pattern into object.

Pyjo.Regexp uses internally cache and compiles pattern only once. Setting flag o means that cache is not used.

Functions

Pyjo.Regexp.r(pattern, flags='')
re_obj = r(pattern, flags='')

Compile pattern with flags into regexp object.