Solved

NB NB!! Help with Reg Exp

Posted on 2002-03-13
4
151 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

809 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