Use console.error for error reporting, and added a regex usage example.