Solved

Find & replace in Dreamweaver code to: add +1 to many id's

Posted on 2013-06-22
3
258 Views
Last Modified: 2013-07-11
Hi,

I have many div's 300+ in a file in Dreamweaver and i was wondering if it is possible to search:
<div id="xxxx">

And replace that with:
<div id="_ftn1">

And the next with:
<div id="_ftn2">

And so on. This would save me tons of manual work! Is this possible with some kind of regual expression or something? If yes.. how?

Thanks
0
Comment
Question by:peps03
3 Comments
 
LVL 16

Assisted Solution

by:rbudj
rbudj earned 250 total points
ID: 39267945
I do not know of any automated way of doing this. Probably in the time it would take you to find a solution, you could just search for the id="xxxx" and then change it manually each time. Provided that you only have this one document. 300 should not take more that 10-20 minutes
0
 
LVL 26

Accepted Solution

by:
wilcoxon earned 250 total points
ID: 39268852
This will do what you want and leave the original file with .bak appended to the name.
perl -i.bak -pe 's{(<div\s+id=")[^"]+">}{$1."_ftn".(++$i)."\">"}e' input_file

Open in new window

0
 

Author Closing Comment

by:peps03
ID: 39317747
Thanks!!
Sorry for late reply!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
For those who don't know, Adobe Dreamweaver is a popular commercial web editor that enables you to design, build and manage complex websites. The editor is a WYSIWYG (What You See Is What You Get) web editor, which means that you can create your web…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now