How do I remove a line of code in dreamweaver

I have several pages that use the same code except for one number that changes in each instance.

          <a href="<?php echo "$sci",$num+4,".php"; ?>">Science</a><br />

the number 4 is what changes in each instance. I want to remove this line from each page in my document with "find & replace"

How would I write the "search for" to include all occurrences of this line?
ambantinAsked:
Who is Participating?
 
khaledfCommented:
hi,

you can do it like this

(<a href="<\?php echo "\$sci",\$num\+).(,"\.php"; \?>">Science</a><br />)

0
 
khaledfCommented:
I would use notepad++ for this, dreamweaver is sometimes confusing when it comes to finding and replacing code.
0
 
ambantinAuthor Commented:
I have many pages and it is several times in each of the pages... I would like to do a "replace all"
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
khaledfCommented:
use infoRapid Search & Replace tool.
very handy for replacements on multiple files
http://www.inforapid.de/html/srdownload.htm
0
 
ambantinAuthor Commented:
OK just installed notepad++ how would I write the "find what" to include all occurrences?
0
 
ambantinAuthor Commented:
lol..ok just installed infoRapid... how would I write the "search for" to include all occurrences?
0
 
khaledfCommented:
since you want to change it on multiple files then better use InfoRapid as it is free and versatile.

isn't this the line you want to remove?
<a href="<?php echo "$sci",$num+4,".php"; ?>">Science</a><br />

just search for it
0
 
ambantinAuthor Commented:
but the the number "4" is different in every instance (1,2,3,4,5,6,7...)
0
 
khaledfCommented:
for me I would right click on the folder containing my files then select search with inforapid
then in the search tap put it in the "search for" field

then in the replace tab type a space in the replace with field
thats it
:)
0
 
ambantinAuthor Commented:
the numeral 4 that is in the line of code is not in every instance of the code... it is a different number in each occurrence.. so I would need some type of a wildcard...
0
 
Jason C. LevineNo oneCommented:
Hi ambatin,

You do not need a third party program to do this.  Dreamweaver supports regular expressions in its Find and Replace functions.  Do Edit | Find and Replace and set the options as follows:

Find in: Entire Current Local Site
Search: Source Code
Find:

<a href="<\?php echo "\$sci",\$num\+[0-9],".php"; \?>">Science</a><br />

Replace: leave it blank.
Options: Check "Use regular expression" and clear "Match case"

Run it.  The magic happens with the [0-9] section which will match any one number.  Since this is a regular expression, we have to escape all ? $ + symbols which is done by a backslash \
0
 
Jason C. LevineNo oneCommented:
Which is basically the same as my solution, only done with a different regex method.
0
 
ambantinAuthor Commented:
ok..what if the numbers go from 0-135
0
 
Jason C. LevineNo oneCommented:
Use:

<a href="<\?php echo "\$sci",\$num\+[0-9]+,".php"; \?>">Science</a><br />

instead
0
 
ambantinAuthor Commented:
Thanks guys
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.