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

  • Home
  • SEARCH
  • 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 3437246
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:02:30+00:00 2026-05-18T08:02:30+00:00

Strange question, but I won’t waste time explaining why I need to do this,

  • 0

Strange question, but I won’t waste time explaining why I need to do this, just that I need to do it.

I have the following:

<input type="radio" name="eq_9" id="eq_9_2"  onclick="nextStepID_load(this);" value="Installer." title="912" /><label for="eq_9_2">Installer</label> <br />

I need to turn that into:

<button type="button" name="eq_9" id="eq_9_2" onclick="nextStepID_load('912');">Installer</button><br />

I am using C#/asp.net (3.5 or below), and javascript for the performJS(which is a placeholder until I figure out how to replace the html).

Please note, the source providing this is sending me a string with the MANY rows of the inputs. And I need to replace each row with the info that is valid for it.

Right now, I’ve tried adding a .Replace(“”,”\”>”); which does replace the radio tags, but obviously makes it look horrible codewise, and doesn’t remove the label or put the label contents in between the tags.

I’m sure this is probably best solved by a regex, but I’m not very familiar with regex. I have been toying with regexlib to see if I can figure out a regex on my own… here is what I have so far, although I imagine I’m pretty far off.

string strRegex = @"<input type=""radio"" [\s]*=[\s]*""?[^\w_]*""?[^>]*>";
RegexOptions myRegexOptions = RegexOptions.IgnoreCase | RegexOptions.Multiline;
Regex myRegex = new Regex(strRegex, myRegexOptions);
string strTargetString = @"<input type=""radio"" name=""eq_9"" id=""eq_9_2""  onclick=""nextStepID_load(this);"" value=""Installer."" title=""912"" /><label for=""eq_9_2"">Installer</label> <br />";
string strReplace = "<button type="button"></button>";
return myRegex.Replace(strTargetString, strReplace);
  • 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-05-18T08:02:30+00:00Added an answer on May 18, 2026 at 8:02 am

    I’m sure this is probably best solved by a regex, but I’m not very familiar with regex.

    I’m afraid that is not a good sign, since if you are not very familiar with regexes, then it is rather unlikely that anything is best solved by a regex. 🙁

    There isn’t enough description of the problem to know for sure whether even a regex wizard could quickly craft a solution using regexes. I am pretty sure you need to do more than merely exchange one fixed string for another, because if you did, you’d’ve done that already. So parts of it must be parameterized. I just don’t know which.

    Not counting whitespace, would you say that your problem is one of transforming input of this form:

    <input 
        type="radio"
        name="eq_X"
        id="eq_X_Y"
        onclick="nextStepID_load('XNY');"
        value="Z."
        title="XNY"  
    />
    <label for="eq_X_Y"> Z </label>
    <br />
    

    into output of this form:

    <button 
        type="button" 
        name="eq_X" 
        id="eq_X_Y" 
        onclick="nextStepID_load('XNY');" 
    >
    Z
    </button>
    
    <br />
    

    As you see, I’ve parameterized X, Y, Z, and N. Here are questions I have for you:

    1. Would you say my parameterization of your problem describes it accurately?

    2. Does this validate under some particular DTD, and if so, which one?

    3. Are the attributes always none other than those?

    4. Are the attributes that occur always in that precise order?

    5. How many such things do you have to do?

    6. Does this occur in plain HTML, or is it actually hidden in some Javascript?

    7. Do you know whether there are any <script> or <style> elements, or <!-- ... --> comments that contain things that look just what you are looking for?

    8. Do you know whether there are any such elements intervening in the middle of the thing you are looking for?

    9. Are all the attributes of the form NAME="VALUE" with only double quotes around the value, never single quotes or omitted altogether?

    10. Is the casing of the identifiers always in lower case?

    11. Are they all in one file?

    12. Is there some reason that your output sample lost some of its non-significant whitespace?

    It is questions like these that show why the problem is almost certainly much more complicated than it appears — which begs a couple of final questions:

    1. Have you ever used an HTML parsing class before?

    2. Would you like to learn how?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Very strange question but I have some legacy code that interacts with another application
This might sound kinda strange question but I am puzzled. I was just looking
This might sound like a strange question, but bear with me... I have a
Strange question, but someone showed me this, I was wondering can you use the
Maybe a strange question, but I need to test the stability and error procedures
This may sound like a strange question, but hopefully there is an answer out
I am afraid to ask a strange question but I want to change pathInfo
Strange question I know, but I'm developing a .net site, it's going to be
This might be a pretty strange question in the eyes of some of you

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.