There is no such type as "a raw string" -- there are literals (of string types) that are so named, but the objects such literals stand for are string objects -- nothing more, nothing less. For example, literals r'a\b'' (a "raw string literal") and 'a\\b' (a normal string literal) represent exactly the same string value: one of length three, with characters a, backlash, and b, in this order. If you print these objects, both display as a\b; if you print their repr, it's a\\b in both cases.
So, it's hard to understand your question. Could you give examples of some possible values for fileMask and fileName, and the results you expect from the consequent re.search calls?
Also,
I actually need the fileMask function
to be called.
That might really be a problem, because there appears to be no function named fileMask, but rather (it would seem) a string thus named. Do you mean "need the method of fileMask to be called"?