473,508 Members | 2,335 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamical replacing

Hi,

I need to replace some dynamical content away from a text, only static thing
is that it starts with <!-- Start dynamic --> and ends with <!-- End dynamic
-->. How do i dynamical remove these two tags and all the content between
them?

Thank you very much.
--
Regards,
Sune

Jul 22 '05 #1
5 1221
Sune wrote on 15 feb 2005 in microsoft.public.inetserver.asp.general:
I need to replace some dynamical content away from a text, only static
thing is that it starts with <!-- Start dynamic --> and ends with <!--
End dynamic -->. How do i dynamical remove these two tags and all the
content between them?


Where would you want to remove it?
In an asp-file on a server?

With what would you want to remove it?
With the execution of another(!) asp-file?
When that file is requested from clientside?

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 22 '05 #2
> Where would you want to remove it? In an asp-file on a server?

With what would you want to remove it?
With the execution of another(!) asp-file?
When that file is requested from clientside?

Lets take the example that i have got the text/html in a database, and i
pull it out to the user when he requests the page. On-the-fly i want it removed
(and posssibly some of it replaced by something else), just like it's possible
to do with static content using the Replace function.

To explain it in another way, what i need is actually some solution that
works like the Replace function, but supports wildcards so i could do like
these examples:
Replace(text, "<!-- Start dynamic -->*<!-- End dynamic -->", "")
Replace(text, "<!-- Start dynamic -->*<!-- End dynamic -->", "Static text")

Got any ideas?
--
Regards, Sune

Jul 22 '05 #3
Sune wrote on 15 feb 2005 in microsoft.public.inetserver.asp.general:
To explain it in another way, what i need is actually some solution
that works like the Replace function, but supports wildcards so i
could do like these examples:
Replace(text, "<!-- Start dynamic -->*<!-- End dynamic -->", "")
Replace(text, "<!-- Start dynamic -->*<!-- End dynamic -->", "Static
text")


Use VBS Regex replace:

<%

text = "1 11<!-- Start dynamic -->2 22<!-- End dynamic -->3 33"

regexstr = "<!-- Start dynamic -->.*<!-- End dynamic -->"

response.write ReplaceTest(text, regexstr, "")

Function ReplaceTest(text, patrn, replStr)
Dim regEx
Set regEx = New RegExp
regEx.Pattern = patrn
regEx.IgnoreCase = True
ReplaceTest = regEx.Replace(text, replStr)
End Function

%>
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 22 '05 #4
To explain it in another way, what i need is actually some solution that
works like the Replace function, but supports wildcards so i could do like
these examples:
Replace(text, "<!-- Start dynamic -->*<!-- End dynamic -->", "")
Replace(text, "<!-- Start dynamic -->*<!-- End dynamic -->", "Static text")


Assuming you're using VBScript, check the Replace method of the RegExp
object:
http://msdn.microsoft.com/library/de...mthreplace.asp

Set regEx = new RegExp
regEx.pattern = "(<!-- Start dynamic -->)(.*)(<!-- End dynamic -->)"

replStr = "<!-- Start dynamic -->something or other<!-- End dynamic
-->"

newStr = regEx.replace(replStr, "$1$3")

newStr now contains "<!-- Start dynamic --><!-- End dynamic -->"

--
Tim Slattery
MS MVP(DTS)
Sl********@bls.gov
Jul 22 '05 #5
> Assuming you're using VBScript, check the Replace method of the RegExp
object:
http://msdn.microsoft.com/library/de...ry/en-us/scrip
t56/html/vsmthreplace.asp

Thank you very much, you just saved my day :)
--
Regards,
Sune

Jul 22 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1816
by: Rutger Claes | last post by:
How do I stop the SAX parser from replacing entities such as &#xE3; and &#xA9;. When I use &gt; and a default_handler, the default_handler is called and I can just print the data. Entities as &#xA9;...
3
8432
by: John Livermore | last post by:
From javascript in IE, I have a need to hijack the onclick event for an element and replace it dynamically with my own. I have tried the following... control.onclick = 'myHandler();'; but...
7
1716
by: Rob Meade | last post by:
Hi all, Been a long time since I've been here... /me waves to all.. Ok - my conundrum.. I have a form where a user can enter text and BB codes...for example:
3
2237
by: dornick | last post by:
So I want to do the above, and I really, REALLY don't want to rewrite the entire file. I've been working on it for a while now, and can't for the life of me get it functioning. Basically, I want...
0
1088
by: Jacob Kroon | last post by:
Hi, I'm having some problems with implementing dynamical module loading. First let me describe the scenario with an example: modules/ fruit/ __init__.py apple.py banana.py
0
1123
by: paula | last post by:
I've got a problem with asp.net i am trying to make a menu control. and have searched the web for serveral controls but they don't work correctly. I am pretty new to asp.net building. What am i...
4
3522
by: FraterQ | last post by:
Hello, after i've read this post, i tried it myself and it works....
1
4489
by: patelgaurav85 | last post by:
Hi, I want to convert xml in one format into another xml format shown below Input xml : <Name> <Name1> <Name11>Name11</Name11> <Name12>Name12</Name12>
2
1135
by: jarino | last post by:
Hi, I have a simulation program that I want to port from matlab to C. But my C has gone rusty.. I have a system (in the mathematical sense) which, at each iteration, gets in a new state. In...
0
7224
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7323
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7039
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7494
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5050
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4706
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1553
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
415
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.