Regex in javascript removes require statements