Need help on Batch 2 (find/replace)

A place to try and solve your RegEx problems.
Post Reply
D1Knauer
Posts: 3
Joined: Mon Jul 21, 2014 2:54 pm

Need help on Batch 2 (find/replace)

Post by D1Knauer »

The standard "find and replace" is no problem.
However, when I tried to do it with a Batch file and a more complicated string search, it doesn't work.
The task should be:

Find in a *.html-file segment an expression that begins with:
<div id="nav">
...and ends with:
</div> <!--end tag nav!-->
...or should it be the whole code between?

then, replace it with:
<!--#include virtual="includes/navigation_tr-intern.inc" -->

It is a typical action to use SSI in a WEB page instead of the whole code.
It would be nice, if somebody would help me make it run.

Thanx
Dieter
User avatar
DigitalVolcano
Site Admin
Posts: 1717
Joined: Thu Jun 09, 2011 10:04 am

Re: Need help on Batch 2 (find/replace)

Post by DigitalVolcano »

This should do it (Regular expression mode, with 'Dot matches newline' checked)

Regex:
<div id="nav">.*?</div> <!--end tag nav!-->


Replace:
<!--#include virtual="includes/navigation_tr-intern.inc" -->
D1Knauer
Posts: 3
Joined: Mon Jul 21, 2014 2:54 pm

Re: Need help on Batch 2 (find/replace)

Post by D1Knauer »

That's it. I guess it should be easy - but you have to know it.
Thanks a lot!
Dieter
Post Reply