March 2nd, 2013, 02:18 PM
Finding all content incl. returns between 2 phrases..?
I want to use a regular expression that will find all content between a defined start and end phrase such as between </title> and </head> or between <!-- and --> for comments.
Any combination of spaces, new lines, returns and any symbols, numbers and letters could occur between the defined start and end phrases that i mentioned above. So I only want the find to stop if it encounters that phrase in its entirety. I want the start and end phrase included in the replace operation.. So i can alter them too if necessary.
This is for use in Dreamweaver's Find and Replace.
March 2nd, 2013, 06:11 PM
I tried using (.*?) between the tags and it isn't catching new lines.
March 2nd, 2013, 09:21 PM
your DreamWeaver needs to support either non-greedy quantifiers or negative lookahead assertions. If it doesn't, you're out of luck.
The pattern for non-greedy quantifiers would be
You might need to turn on some "multi line" mode to make the dot match the newline characters. If that's not possible, use [.\r\n] instead.
You should also add optional whitespace within the tags to make them more robust.
Note that regexes aren't made for complex languages like HTML. If you need your replacements to, for example, respect the element nesting, forget that DreamWeaver stuff and grab an actual HTML parser.
March 3rd, 2013, 12:03 AM
Originally Posted by Jacques1