Solved

NB NB!! Help with Reg Exp

Posted on 2002-03-13
4
148 Views
Last Modified: 2010-05-02
Hi There

I am writing a reg exp to replace all .htm and .html links in hyperlinks to .asp ie

<A HREF=21348.htm alt="solution">Print Format</A> to
<A HREF="21348.asp" alt="solution">Print Format</A>

<a href=21348.htm#Solution alt="solution">Solution Explained</a> to
<a href="21348.asp#Solution" alt="solution">Solution Explained</a>

Here is what I have so far:
<a(.*?)href=[""']?(.*?)\.(htm)(.*?)[""']?(.*?)>

and to replace:
"<a$1href=""$2.asp$4"">"

This is extremely urgent!!!!!

Cheers,

Sam



0
Comment
Question by:SammyG
4 Comments
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
<a(.*?)href=[""']?(.*?)\.(htm)(.*?)[""']?(.*?)>
    $1            $2           $3        $4

try this as the replacement string.

"<a$1href=""$2.asp$3""$4>"

You may also have to replace all ? with a $x so try

<a(.*?)href=[""']?(.*?)\.(htm)(.*?)[""']?(.*?)>
    $1          $2  $3         $4      $5   $6

"<a$1href=""$2$3.asp$4""$5$6>"

good luck
mlmcc
0
 

Author Comment

by:SammyG
Comment Utility
Thanks for the reply

It didn't seem to work and I eventually came up with:
<a href=sam.htm#test alt="here" id="dog">test</a>

<a(.*?)href\s*=\s*["']?(.*?)\.html?(.*?)["']?\s+(.*?)>

<a$1href="$2.asp$3" $4>

Cheers,

Sam
0
 
LVL 49

Expert Comment

by:DanRollins
Comment Utility
SammyG, an EE Moderator will handle this for you.
Moderator, my recommended disposition is:

    Refund points and save as a 0-pt PAQ.

DanRollins -- EE database cleanup volunteer
0
 
LVL 1

Accepted Solution

by:
kodiakbear earned 0 total points
Comment Utility
Moving to the paq

kb
Experts Exchange Moderator
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

772 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

11 Experts available now in Live!

Get 1:1 Help Now