开发者

xcode regular search/replace bug?

开发者 https://www.devze.com 2023-04-02 22:07 出处:网络
I am attempting to refactor some old code, and want to replace [self.* release]; with self.* = nil; where * is some property name.

I am attempting to refactor some old code, and want to replace [self.* release]; with self.* = nil; where * is some property name.

I am using a regular expression search like (\[self\.)(\w)+[\s](release\]) and for the replacement text I am using self.\2 = nil. This all goes fine (180 results, yay) but when I preview (or perform the replace), the result only copies the开发者_StackOverflow last letter of the \w token.

For example, [self.property release]; would become self.y = nil;. Anyone know what is up here?

Thanks


I know this is little bit old, but I wanted this and solved it like below

(\[self\.)(.*)( release\])


Try: (\[self\.)(\w)*[\s](release\])

0

精彩评论

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