Dreamweaver 的“搜索”和“用通配符替换”是否有可变选项?
假设我有很多区域,例如:
乔正在打吉姆,
乔正在踢吉姆,
乔正在向吉姆吐口水。
我想找到 joe is _____ jim 的每个案例,并完全改变顺序。通常我只会进行通配符搜索,然后搜索并替换“joe is [^”]* jim”。但是如果我想保留通配符是什么并简单地重新排列单词怎么办?(有点像使用 [^"] 作为替换窗口中的变量)。
基本上我想做的是搜索并将“joe is [^”]* jim”替换为“jim is [^”]* joe”(没有“[^”]*”字面显示为替换文本)。我知道有人可能会说
“你为什么不只搜索并替换 jim 和 joe,并忽略 [^”]* ?”
好吧,如果通配符可以作为搜索和替换中的变量存储,那么您可以执行 1 中需要多个步骤的操作。
如果不是 Dreamweaver,是否有任何其他编码环境可以让您执行此操作?
Lets say I have a bunch of areas like:
joe is punching jim
joe is kicking jim
joe is spitting on jim.
and I wanted to find every case with joe is _____ jim and completely change the order around. normally I would just do a wilcard search, and search and replace "joe is [^"]* jim". but what if i wanted to KEEP whatever the wildcard was and simply rearrange the words? (kinda like using [^"] as a variable in the replace window).
basically what I want to do is search and replace "joe is [^"]* jim" with "jim is [^"]* joe" (without "[^"]*" literally appearing as the replaced text). I know someone will probably say
"why don't you just do search and replaces for both jim and joe, and ignore the [^"]* ?"
well if the wildcard could be stored as a variable in the search and replace, then you can do what would take multiple steps in 1.
if not dreamweaver, are there any other coding environments that will let you do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
搜索
joe is ([^<]*) jim
并替换为jim is $1 joe
。如果您有多个
([^<]*)
通配符,您可以使用$1, $2, $3...
引用所有通配符找到它 此处。
Search for
joe is ([^<]*) jim
and replace withjim is $1 joe
.If you have several
([^<]*)
wildcards, you can refer to all of them with$1, $2, $3...
Found it here.