开发者

Simple find/replace using regex in Eclipse

开发者 https://www.devze.com 2023-01-21 16:52 出处:网络
I have the following possible lines in my cod开发者_运维技巧e addEventListener(PropertyChangeEvent.PROPERTY_CHANGE, propertyChangeHandler)

I have the following possible lines in my cod开发者_运维技巧e

addEventListener(PropertyChangeEvent.PROPERTY_CHANGE, propertyChangeHandler)
addEventListener("click", propertyChangeHandler)
addEventListener(PropertyChangeEvent.PROPERTY_CHANGE, _propertyChangeHandler)
addEventListener(PROPERTY_CHANGE, _propertyChangeHandler)

They all have in common that they start with addEventListener( have one , in the middle and end with a )

What would be the proper regex to cover all cases and add ,false,0,true before the closing parenthesis )

So it would look like:

addEventListener(PROPERTY_CHANGE, _propertyChangeHandler ,false,0,true )

Thank you for your time


A matching regex would be: (addEventListener\([^,]+,[^)]+)\). The corresponding replace expression is $1,false,0,true).

0

精彩评论

暂无评论...
验证码 换一张
取 消