xoa.misc.match_string

xoa.misc.match_string(ss, checks, ignorecase=True, transform=None)[source]

Check that a string verify a check list that consists of a list of either strings or callables

Parameters:
  • ss (str) –

  • checks (str, callable, list of {str or callable}) –

  • ignorecase (bool) –

  • transform (callable) –

Example

In [1]: import re

In [2]: match_string('sst', 'sst')
Out[2]: True

In [3]: match_string('sst', [re.compile(r'ss.$').match])
Out[3]: True
Returns:

True