MCPcopy Create free account
hub / github.com/boostorg/build / match_re

Function match_re

v2/test/TestCmd.py:195–211  ·  view source on GitHub ↗

Given lists or strings contain lines separated using newline characters. This function matches those lines one by one, interpreting the lines in the res parameter as regular expressions.

(lines=None, res=None)

Source from the content-addressed store, hash-verified

193
194
195def match_re(lines=None, res=None):
196 """
197 Given lists or strings contain lines separated using newline characters.
198 This function matches those lines one by one, interpreting the lines in the
199 res parameter as regular expressions.
200
201 """
202 if not type(lines) is ListType:
203 lines = split(lines, "\n")
204 if not type(res) is ListType:
205 res = split(res, "\n")
206 if len(lines) != len(res):
207 return
208 for i in range(len(lines)):
209 if not re.compile("^" + res[i] + "$").search(lines[i]):
210 return
211 return 1
212
213
214class TestCmd:

Callers 1

match_reMethod · 0.70

Calls 2

splitFunction · 0.85
searchMethod · 0.80

Tested by

no test coverage detected