Solved

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

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

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Need icon art 9 110
Need some Regex Help 3 48
numeric only entry in text inpu 9 44
create a gui in perl 3 88
I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
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…
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…

777 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