Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8661911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:36:42+00:00 2026-06-12T16:36:42+00:00

I am having following set of image map tags; <map name=planetmap> <area shape=rect coords=0,0,82,126

  • 0

I am having following set of image map tags;

<map name="planetmap">
  <area shape="rect" coords="0,0,82,126" href="sun.htm" alt="Sun">
  <area shape="circle" coords="90,58,3" href="mercur.htm" alt="Mercury">
  <area shape="circle" coords="124,58,8" href="venus.htm" alt="Venus">
</map>

I need to extract href attribute and replace it with another url

I am using following code but does not seems to work;

string input = @"<area shape=""rect"" href=""http://www.google.com"">";
            string pattern = "(href=([^ ]+))";
Regex rgx = new Regex(pattern);
string result2 = rgx.Replace(input, m => m.Groups[1].Value.Replace(result,"test.com"));

Could someone please help me.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T16:36:43+00:00Added an answer on June 12, 2026 at 4:36 pm

    I can see two things that may be causing an issue. The first is, your regex is checking for a string in the format of href=http://example.com. Note, there are no quotes around the URL. So, we’ll need to update the regex to handle the double-quotes like your input contains.

    The second is that you’re using the matched group 1, but your regex is actually matching two separate groups (and you want to replace the second one). You don’t need the first matching group at all, so we can actually drop this part.

    In all, try updating your regex to:

    href="([^"]+)"
    

    In your variable, it will look like:

    string pattern = @"href=""([^""]+)""";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Box bordered in Red is my Droppable div area. which is having image set
I'm having the following data set (note that my database/schemata is somewhat complex so
I am having the following problem: a) I have a UNIX build environment set
I'm having the following interfaces: public interface IBase { int id1 { get; set;
i'm having the following markup using 2 divs. the #child div has set position:absolute;
I am having following code for getting image from the web: NSURL *ImageURL =
I am having an issue positioning a background image using the following jquery background
I have written following code to set the status of the image button to
I have DB2 table having following structure CREATE TABLE DUMMY ( ID CHARACTER(10) NOT
I am having following class hierarchy - //Abstract Class1 in library1 (Can't modify this)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.