smpl_io.io.glob_re

smpl_io.io.glob_re(pattern, path)[source]

Returns all strings that match the regex pattern.

Parameters

patternstr

regex pattern.

pathstr

path to search in.

Returns

list

list of filenames that match the regex pattern.

Examples

>>> import os
>>> with pushd("tmptest",tmp=True,cd=False):
...     write("tmptest/test.txt","hi\nho1\n2\n3\n4\n")
...     glob_re(".*[xt][xt][xt]", "tmptest")
['test.txt']