regex matching expression notepad++ [duplicate]

久未见 提交于 2019-12-25 18:39:49

问题


I am really having trouble with regex using notepad++:

For any single word following an equal sign (=), place what follows the equal sign in quotes. eg: a = bcd becomes a = "bcd"

This is what I have but it is giving me problems:

s/=\([^" >][^ >]*\)/="\1"/g

* I am using the regex to search through a word document in Notepad++


回答1:


Try this:

Search: (=\s*)(\w+\b)
Replace: $1"$2"




回答2:


This should work

$searchText =~ s/(\w* *\= *)(\w*)/$1"$2"/g;

You should be specific about what is a word and what isn't and other constraints




回答3:


To place quotes around anything unquoted after equals in Notepad++ using a regex:

Find What: =\s*([^"]*)$ Replace With: = "\1"



来源:https://stackoverflow.com/questions/16380039/regex-matching-expression-notepad

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!