def __build_word_numeral(*args):
 re_ = None
 for word_list in args:
  for word in word_list:
   if (not re_):
    re_ = '(?:(?=\\w+)'
   else:
    re_ += '|'
   re_ += word
 re_ += ')'
 return re_

def __build_word_numeral ( * args ) : re_ = None for word_list in args : for word in word_list : if ( not re_ ) : re_ = '(?:(?=\\w+)' else : re_ += '|' re_ += word re_ += ')' return re_
build word numeral regexp from list .