I'm trying to replace all of the event handling functions whose name is either "eventHandler" or ends with "...EventHandler" to be encapsulated in a common event-handling function which does additional tasks before actually calling a event handler.
In short, I'm trying to do this (in sublime text editor) using the regular expression in find & replace:
loginEventHandler(args, callback) => processEventHandler(loginEventHandler, args, callback)
[ Find ]
(eventHandler|(?!processEventHandler)\w+EventHandler)((.*))
[ Replace ]
processEventHandler($1, $2)
This isn't working as expected. The find is also matching rocessEventHandler . How do I ignore matching the function if the function name is "processEventHandler"?
I tried solutions mentioned in the following questions, but didn't help.
Regular expression to match line that doesn't contain a word?
A regular expression to exclude a word/string
Here is the test result: