Solved

NB NB!! Help with Reg Exp

Posted on 2002-03-13
4
150 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
ID: 6862783
<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
ID: 6863937
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
ID: 7618267
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
ID: 7665696
Moving to the paq

kb
Experts Exchange Moderator
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

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…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

770 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