Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我真的在使用 notepad++ 的正则表达式时遇到了麻烦:
对于等号 (=) 后面的任何单个单词,请将等号后面的内容放在引号中。例如:a = bcd变成a = "bcd"
a = bcd
a = "bcd"
这就是我所拥有的,但它给我带来了问题:
s/=\([^" >][^ >]*\)/="\1"/g
*我正在使用正则表达式在 Notepad++ 中搜索 word 文档
试试这个:
搜索:(=\s*)(\w+\b) 替换:$1"$2"
(=\s*)(\w+\b)
$1"$2"
这应该工作
$searchText =~ s/(\w* *\= *)(\w*)/$1"$2"/g;
您应该具体说明什么是单词,什么不是单词以及其他限制
使用正则表达式在 Notepad++ 中的等号之后为任何未引用的内容添加引号:
查找内容:=\s*([^"]*)$ 替换为:= "\1"
=\s*([^"]*)$
= "\1"