Replaced JS regexp by AST walker