Solved

NB NB!! Help with Reg Exp

Posted on 2002-03-13
4
153 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 101

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
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…

729 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