开发者

Does Dreamweaver's Search and Replace with wildcard have a variable option?

开发者 https://www.devze.com 2023-01-04 06:50 出处:网络
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.

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 mult开发者_如何学运维iple steps in 1.

if not dreamweaver, are there any other coding environments that will let you do this?


Search for joe is ([^<]*) jim and replace with jim is $1 joe.

If you have several ([^<]*) wildcards, you can refer to all of them with $1, $2, $3...

Found it here.

0

精彩评论

暂无评论...
验证码 换一张
取 消