简体   繁体   English

在Sublime Text中使用正则表达式搜索和替换

[英]Search and replace using a regex in Sublime Text

How to do a search and replace with Sublime Text, so it finds "(wildcard)" ? 如何进行搜索并替换为Sublime Text,使其找到"(wildcard)"

I want to do a simple find and replace to get curly quotes, I expect that this can be done using regex. 我想做一个简单的查找和替换以获取大括号,我希望可以使用正则表达式来完成。

Thanks :) 谢谢 :)

If you're looking to make curly quotes into straight quotes, then can you just replace , ' , , and ' with " , ' , " , and ' , respectively? 如果您希望将弯引号变成直引号,那么可以分别用'' "替换 ' '"'吗? But maybe that is not your aim. 但这也许不是您的目标。 You should be able to use the curly quotes "literally" in your regex, eg 您应该能够在正则表达式中“按字面地”使用弯引号, 例如

“(.*?)”

EDIT: 编辑:

Ah, so you want to convert straight quotes to curly quotes. 嗯,所以您想将直接引号转换为卷曲引号。 In that case, try replacing 在这种情况下,请尝试更换

"([^"]*)"

with

“$1”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM