class_docstr: Handle conversion from format directives to regexes.
class_docstr_tok: ["Handle","conversion","from","format","directives","to","regexes","."]
docstr: Convert a list to a regex string for matching a directive.
  
  Want possible matching values to be from longest to shortest.  This
  prevents the possibility of a match occurring for a value that also
  a substring of a larger value that should have matched (e.g., 'abc'
  matching when 'abcdef' should have been the match).
docstr_tok: ["Convert","a","list","to","a","regex","string","for","matching","a","directive",".","Want","possible","matching","values","to","be","from","longest","to","shortest",".","This","prevents","the","possibility","of","a","match","occurring","for","a","value","that","also","a","substring","of","a","larger","value","that","should","have","matched","(","e.g.",",","'abc'","matching","when","'abcdef","'","should","have","been","the","match",")","."]
code: def __seqToRE(self, to_convert, directive):
      """Convert a list to a regex string for matching a directive.
  
      Want possible matching values to be from longest to shortest.  This
      prevents the possibility of a match occurring for a value that also
      a substring of a larger value that should have matched (e.g., 'abc'
      matching when 'abcdef' should have been the match).
  
      """
      to_convert = sorted(to_convert, key=len, reverse=True)
      for value in to_convert:
          if value != "":
              break
      else:
          return ""
      regex = "|".join(re_escape(stuff) for stuff in to_convert)
      regex = "(?P<%s>%s" % (directive, regex)
      return "%s)" % regex
  
imports: import time
  import locale
  import calendar
  from re import compile
  from re import IGNORECASE
  from re import escape
  from datetime import date, timedelta, timezone
  from _thread import allocate_lock
label_desc: Use image node_id 2 for calling the TimeRE obj's underlying member method code with example usage: obj.__seqToRE(to_convert, directive) and returns: unknown, str