I've a pattern to find some words etc in a string. Here is my code:
pattern = {
"eval\(.*\)",
"hello",
"my word"
}
patterns = "|" . join( pattern )
patterns = "(^.*?(" + patterns + ").*?$)"
code = code.strip()
m = re.findall( patterns, code, re.IGNORECASE|re.MULTILINE|re.UNICODE )
if m:
return m
How can i see which of these words (eval(), hello ..) was found? In php i have the function preg_match_all to get the matched word that was found.