chore #67378552, added options, some regexps, some logic