Replace line start with throw '...' with throw new Error(...) Regex: (throw) ('.*');$ Replace: \1 new Error(\2)