def _parse_pattern(self, element):
<EOL>self._log.info('<STR_LIT>' + element.text)<EOL>self.pattern_words, self.pattern_len = self.count_words(element.text)<EOL>self._log.debug('<STR_LIT>'<EOL>.format(wc=self.pattern_words, cc=self.pattern_len))<EOL>regex = bool_attribute(self._element, '<STR_LIT>', False)<EOL>if regex:<EOL><INDENT>self._log.info('<STR_LIT>')<EOL>try:<EOL><INDENT>self.pattern = re.compile(element.text)<EOL><DEDENT>except sre_constants.error:<EOL><INDENT>self._log.warn('<STR_LIT>'<EOL>.format(path=self.file_path, regex=element.text))<EOL>raise AgentMLSyntaxError<EOL><DEDENT>return<EOL><DEDENT>self.pattern = normalize(element.text, True)<EOL>self._log.debug('<STR_LIT>' + self.pattern)<EOL>compile_as_regex = False<EOL>captured_wildcard = re.compile(r'<STR_LIT>')<EOL>wildcard = re.compile(r'<STR_LIT>')<EOL>capt_wild_numeric = re.compile(r'<STR_LIT>')<EOL>wild_numeric = re.compile(r'<STR_LIT>')<EOL>capt_wild_alpha = re.compile(r'<STR_LIT>')<EOL>wild_alpha = re.compile(r'<STR_LIT>')<EOL>wildcard_replacements = [<EOL>(captured_wildcard, r'<STR_LIT>'),<EOL>(wildcard,          r'<STR_LIT>'),<EOL>(capt_wild_numeric, r'<STR_LIT>'),<EOL>(wild_numeric,      r'<STR_LIT>'),<EOL>(capt_wild_alpha,   r'<STR_LIT>'),<EOL>(wild_alpha,        r'<STR_LIT>'),<EOL>]<EOL>for wildcard, replacement in wildcard_replacements:<EOL><INDENT>self.pattern, match = self.replace_wildcards(self.pattern, wildcard, replacement)<EOL>compile_as_regex = bool(match) or compile_as_regex<EOL><DEDENT>req_choice = re.compile(r'<STR_LIT>')<EOL>opt_choice = re.compile(r'<STR_LIT>')<EOL>if req_choice.search(self.pattern):<EOL><INDENT>def sub_required(pattern):<EOL><INDENT>patterns = pattern.group(<NUM_LIT:1>).split('<STR_LIT:|>')<EOL>return r'<STR_LIT>'.format(options='<STR_LIT:|>'.join(patterns))<EOL><DEDENT>self.pattern = req_choice.sub(sub_required, self.pattern)<EOL>self._log.debug('<STR_LIT>' + self.pattern)<EOL>compile_as_regex = True<EOL><DEDENT>if opt_choice.search(self.pattern):<EOL><INDENT>def sub_optional(pattern):<EOL><INDENT>patterns = pattern.group(<NUM_LIT:1>).split('<STR_LIT:|>')<EOL>return r'<STR_LIT>'.format(options='<STR_LIT:|>'.join(patterns))<EOL><DEDENT>self.pattern = opt_choice.sub(sub_optional, self.pattern)<EOL>self._log.debug('<STR_LIT>' + self.pattern)<EOL>compile_as_regex = True<EOL><DEDENT>if compile_as_regex:<EOL><INDENT>self._log.debug('<STR_LIT>')<EOL>self.pattern = re.compile('<STR_LIT>'.format(pattern=self.pattern), re.IGNORECASE)<EOL><DEDENT>else:<EOL><INDENT>self._log.debug('<STR_LIT>')<EOL>self.pattern_is_atomic = True<EOL>self._log.debug('<STR_LIT>')<EOL>self.pattern = self.pattern.replace('<STR_LIT>', '<STR_LIT:*>')<EOL>self.pattern = self.pattern.replace('<STR_LIT>', '<STR_LIT:#>')<EOL>self.pattern = self.pattern.replace('<STR_LIT>', '<STR_LIT:_>')<EOL>self.pattern = self.pattern.replace('<STR_LIT>', '<STR_LIT>')<EOL>self.pattern = self.pattern.replace('<STR_LIT>', '<STR_LIT>')<EOL>self.pattern = self.pattern.replace('<STR_LIT>', '<STR_LIT>')<EOL><DEDENT>
Parse the trigger pattern
:param element: The XML Element object
:type  element: etree._Element