Simple code needed for Dreamweaver Regular Expression

I have several pages where I am using php and I need to find and replace

"$comp",$num+1,".php"

with

"$comp"

However, the +1 in the original is +1 to +32 in the pages

I need someone to reply with the code I need to do this..
ambantinAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gary DavisDir Internet SvcsCommented:
The regex to match the string with 1 to 2 digits following the + is:

"\$comp",\$num\+\d{1,2},"\.php"

The $ + and . need to be escaped with teh backslash. The \d{1,2} means 1 or 2 digits.
The " and , do not need to be escaped.

Gary Davis

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ambantinAuthor Commented:
didn't work...
ambantinAuthor Commented:
here is another example

"$comp",$num+1,".php"
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

käµfm³d 👽Commented:
Remove the leading and trailing quotes from gardavis' suggestion if you included them in the Find box. That is unless you are trying to find the quotes as well  = )
ambantinAuthor Commented:
still not working... ugh
käµfm³d 👽Commented:
Is this for the Find/Replace dialog, or for ReReplace function?
ambantinAuthor Commented:
Find Replace - Dreamweaver MX
käµfm³d 👽Commented:
I think I told you a white lie...  because I misread your original example. In gardavis' example, leave the quotes, but try replacing the "\d{1,2}" with a literal "1".

i.e.
"\$comp",\$num\+1,"\.php"

Open in new window

käµfm³d 👽Commented:
To account for the "+32", try using:

"\$comp",\$num\+[0-9]+,"\.php"

Open in new window

ambantinAuthor Commented:
still not found in current document....
ambantinAuthor Commented:
here is a sample of the code I am using

it is the comp line that needs to be changed in every page... 76 entries
</tr>
  <tr> 
    <td height="134" align="center" valign="middle">&nbsp;</td>
    <td align="center" valign="middle"> <h2><a href="<?php echo "$socstud",$num,".php"; ?>">Social 
        Stud</a><br />
        <a href="<?php echo "$whist",$num,".php"; ?>">World 
        Hist</a><br />
        <a href="<?php echo "$lgsocstud",$num,".php"; ?>"><font color="#00FF00">Social 
        Stud</font></a><br />
        <a href="<?php echo "$comp",$num,".php"; ?>">Computer</a><br />
        <a href="<?php echo "$math",$num,".php"; ?>">Math</a><br />
        <a href="<?php echo "$science",$num,".php"; ?>">Science</a><br />
      </h2></td>
    <td align="center" valign="middle"> <h2><a href="<?php echo "$rel",$num+1,".php"; ?>">Religion</a><br />
        <a href="<?php echo "$lgsocstud",$num+1,".php"; ?>"><font color="#00FF00">Social 
        Stud</font></a><br />
        <a href="<?php echo "$comp",$num+1,".php"; ?>">Computer</a><br />
        <a href="<?php echo "$biology",$num+1,".php"; ?>">Biology</a><br />
        <a href="<?php echo "$science",$num+1,".php"; ?>">Science</a><br />
        <a href="<?php echo "$health",$num+1,".php"; ?>">Health</a><br />
      </h2></td>

Open in new window

käµfm³d 👽Commented:
Silly question (which assumes I'm looking at an applicable version in the screenshot I reviewed):  Do you have the "Use Regular Expressions" box checked?
ambantinAuthor Commented:
yes i do
ambantinAuthor Commented:
Has anyone got it to work?
Gary DavisDir Internet SvcsCommented:
Does DreamWeaver regular expressions work the same as others? My example at the top is based on ASP.Net but there is nothing really unusual or non-portable in what I described.

Ambantin, how do you call the regex? Can you show your code?

Gary
ambantinAuthor Commented:
Dreamweaver is menu driven
000000.jpg
Gary DavisDir Internet SvcsCommented:
I got it to work. Initially it failed due to a newline at the end of the regexp in the Find window. Make sure the cursor is at the end of the regexp and that right-cursor does not move to the next line. If so, delete any trailing whitespace.
 Successful find of RegExp
ambantinAuthor Commented:
I have CS3 at the school... at home I only have MX... It worked with CS3 but not MX...
ambantinAuthor Commented:
Doesn't work with macromedia dreamweaver mx
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Regular Expressions

From novice to tech pro — start learning today.