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 4067676
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:16:47+00:00 2026-05-20T16:16:47+00:00

I am working in a classic asp application that requires functionality that will modify

  • 0

I am working in a classic asp application that requires functionality that will modify code that the user copy and pastes into a form. The user is considered a trusted user who is not familiar with html.

I am trying to make it so that if the user wants to change all width="" attributes in the supplied code then all he has to do is fill a textbox label Width with the correct value and press save/submit. Then the script will find all width attributes and update their values in the html snippet that was supplied.

I’ve been working on a regular expression to do this, but while researching I read that a lot of people do not recommend regexps for this type of thing and would rather use a html parser object of some sort.

Is there an html parser or DOM browser/editor available in classic asp or do I just need to continue my regexp development?

For the regexp, this is what I have so far… still need to modify it to perform replacements on all matches, not just the first one:

function replaceBetween(sSource, sStart, sStop, sValue)

    thisNewValue = sStart & sValue & sStop

    set re = new regexp
    re.pattern = "(" & "" &sStart & ")(.*?)(" & sStop & ")"
    re.IgnoreCase = true

    response.write "Pattern: <b>" & re.pattern & "</b><br />" & vbnewline
    response.write "thisNewValue: <b>" & thisNewValue & "</b><br />" & vbnewline
    response.write "match: <b>" & re.test(sSource) & "</b><br />" & vbnewline

    replaceBetween = re.replace(sSource, thisNewValue)


end function

sourceText = ("<div class='thisclass' id=""thisID""><a anotherthing="""" attribute=""one""><a attribute=""2""><a anotherattribute="" attribute=""three 3""></div>")
replacestart = "attribute="""
replacestop = """"
newvalue = "XXXX"

response.write "updated source: <b>" & server.HTMLEncode(replaceBetween(sourceText,replacestart,replacestop,newvalue)) & "</b><br />" & vbnewline
  • 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-20T16:16:47+00:00Added an answer on May 20, 2026 at 4:16 pm

    Is your HTML well formed? If so you could simply use an XML DomDocument. Use XPath to find the attributes you want to replace.

    You can actually use JScript serverside as well in ASP, whicdh might give you access to HTMLDom libraries you could use.

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

Sidebar

Related Questions

I am working on a classic asp form that has a number of dropdowns.
Been working on a classic asp page. I've been using Request.Form(x) and saw that
We have a classic ASP application that simply works and we have been loathe
Let me qualify this question. I'm working on a classic ASP.NET application (Web Forms)
I'm writing an application in classic ASP (yes, please forgive me) that sends e-mails
I'm working on an ASP.net 3.5 project that has evolved out of a Classic
I'm working on updating a classic ASP web page used by a number of
I have this classic ASP site which has been working fine until we updated
Very odd problem as this is working perfectly on our old Classic ASP site.
Working on an old site in asp classic. I want to write a function

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.