Solved

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

Posted on 2013-06-22
3
266 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
regex to extract ip:john 17 74
Perl tar error 8 67
Control Number of Log Files -Perl 7 87
What does msixpodualn stand for and how do I read this "qr/STRING/msixpodualn"? 4 97
by Batuhan Cetin Regular expression is a language that we use to edit a string or retrieve sub-strings that meets specific rules from a text. A regular expression can be applied to a set of string variables. There are many RegEx engines for u…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
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…

830 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