I want to use Find and Replace in dream weaver to find and replace only the words which their lines contain a specific string.

有帮助吗?

解决方案

user3503851, Dreamweaver has a notoriously shoddy regex flavor. Nevertheless, here is a working example, tested in CS6.

Our test text:

My Untitled Document Is Here
My Beautiful Document Is Here
My Document, the Beautiful

The goal: replace "Document" with "Blog", but only in a line that contains the word "Beautiful"

Search: ((?=.*?Beautiful)[^\r\n]*)(Document)

Replace: $1Blog

Result:

My Untitled Document Is Here
My Beautiful Blog Is Here
My Blog, the Beautiful
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top