如何在Eclipse中搜索资源文件? (转义字符)
如何在 Eclipse 的资源文件 (*.properties) 中搜索包含非 ASCII 字符的字符串?
编辑:目前我使用 * 代替那些特殊字符,但我更喜欢 Eclipse 为我处理这个问题:所以当我输入 'á 时,它会在原始文件中搜索 '\u00E1' ',或者它可能会首先翻译文件,然后只搜索“á”。
我很抱歉询问时不够具体。
How do you search in resource files (*.properties) in Eclipse for string containing non-ASCII characters?
EDIT: Currently I use * in place of those special chars, but I'd prefer Eclipse to handle this for me: so it would either search for '\u00E1' in raw files when I enter 'á', or it might translate the files first and then just search for 'á'.
My apologize for not being specific enough when asking.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在Eclipse中,您可以使用搜索 -> 文件搜索。在“搜索”对话框中,选中正则表达式选项。然后在包含文本:字段中输入此模式以查找非 ASCII 字符:(
方括号是该模式的一部分)。输入文件名模式
,然后选择要搜索的资源(选定的资源、工作区、工作集等),然后单击确定
另请参阅Pattern javadoc 了解如何表达此类正则表达式。
In Eclipse, you can use Search -> File Search . In the Search dialog, check the Regular expression option. Then enter this pattern in the Containing text: field to find non-ASCII characters:
(the square brackets are part of the pattern). Enter the File name patterns
and then select which resources to search (selected resource, workspace, working set, etc.) and click OK
See also the Pattern javadoc for how to express such regular expressions.
就个人而言,我使用 grep 从命令行搜索它们,但您可以在 Eclipse 中通过在非正则表达式搜索中使用问号来搜索它们,该搜索应匹配任何字符。您还可以在正则表达式搜索中使用句点。
Personally, I search them from the command line using grep, but you can search them in Eclipse by using a question mark in a non-regular-expression search, which should match any character. You can also use a period in a regular expression search.
搜索对话框允许您在工作区的 *.resources 文件中搜索字符串。
转到搜索 ->文件。启用正则表达式复选框 - 这也有助于根据您的需要选择正则表达式。在文件名模式中,给出 *.properties,然后 Go :)
The search dialog allows you to search for strings in *.resources files in the workspace.
Go to Search -> File. Enable the Regular Expressions checkbox - this also content assist to choose the regular expression according to your needs. In the file name patterns, give *.properties and then, Go :)