regex line pattern bug fix
use re.findall replace slow re.sub
regex bug fix
template empty dir bug fix