xcode 常规搜索/替换错误?

发布于 2024-12-03 03:07:25 字数 375 浏览 4 评论 0原文

我正在尝试重构一些旧代码,并希望将 [self.* release]; 替换为 self.* = nil; 其中 *是一些属性名称。

我正在使用正则表达式搜索,如 (\[self\.)(\w)+[\s](release\]) ,对于替换文本,我使用 self.\ 2 = 零。这一切都很顺利(180 个结果,是的),但是当我预览(或执行替换)时,结果仅复制 \w 标记的最后一个字母。

例如,[self.property release]; 将变为 self.y = nil;。有人知道这里是什么吗?

谢谢

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 last letter of the \w token.

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

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

筱武穆 2024-12-10 03:07:25

我知道这有点旧,但我想要这个并解决它,如下所示

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

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

(\[self\.)(.*)( release\])
终陌 2024-12-10 03:07:25

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

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文