[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

NB NB!! Help with Reg Exp

Posted on 2002-03-13
4
Medium Priority
?
156 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 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month19 days, 17 hours left to enroll

872 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