Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Find and Replace in html

Hey guys, so I have an html document I would like to parse through for multiple strings, ie...

If HELP1 is found replace with
This is the help sentence.

If HELP2 is found in the html document replace with
This is the second help sentence.

Could someone help me do this?
http://msdn.microsoft.com/en-us/library/....110).aspx

PHP Code

<?php 
string someHtmlDoc 
= <someHtmlDoc>;
someHtmlDoc = someHtmlDoc.Replace("HELP1", "This is the help sentence."); 
(Oct 29, 2013 02:26 PM)tweety Wrote:  http://msdn.microsoft.com/en-us/library/....110).aspx

PHP Code

<?php 
string someHtmlDoc 
= <someHtmlDoc>;
someHtmlDoc = someHtmlDoc.Replace("HELP1", "This is the help sentence."); 

That helped, now what about text in the html document?
(Oct 29, 2013 02:53 PM)illLusion Wrote:  That helped, now what about text in the html document?

I don't understand what your saying. Text? That replaces the text and that's all you asked for.
(Oct 29, 2013 02:57 PM)tweety Wrote:  I don't understand what your saying. Text? That replaces the text and that's all you asked for.

You're*
What about if they're multiple instances of the text in question? Or even if OP wants to replace text like, "is" or "or"? Very common combination of letters in many words. Try harder.

@OP, we need more information, this question is very broad with many pitfalls to look for.
'First we check a directory containing your html file
For Each file As String In Directory.GetFiles(yourlocationtograb)
'Then we check if the file in the directory is an html document
If file.EndsWith(".html") 'If it does then we tell the program to open the file and replace the text from your textboxes with the tags in your html file
Then
Dim R As String = IO.File.ReadAllText(file)
Dim text As String = R.Replace("%%yourtextinhtmltobereplaced%%", v3t.Text)
IO.File.WriteAllText(file, text)

End If

Next
'in case there is more then one file
Happy coding
(Oct 29, 2013 04:16 PM)Support. Wrote:  You're*
What about if they're multiple instances of the text in question? Or even if OP wants to replace text like, "is" or "or"? Very common combination of letters in many words. Try harder.

@OP, we need more information, this question is very broad with many pitfalls to look for.

I can't see the reason for you to act like a dick head. Tweety provided an answer more than enough to OP's "question". If you could do it in a better way, show us your muscles.
(Oct 31, 2013 02:03 AM)Lambasoft Wrote:  I can't see the reason for you to act like a dick head. Tweety provided an answer more than enough to OP's "question". If you could do it in a better way, show us your muscles.

Did he ask you to say that or did, "Dick ride mode" enable itself? Everyone complains about this section for various reasons & I amongst others that have also drifted from this section believe second to moderation, or lack of it, Ubers being pedantic fucks to non-upgraded members yet more than willing to help an Ubers until the cows come home is a big problem too.

How are we supposed to teach people like this? How are we suppose to welcome any new members apart from close-minded morons who don't want to learn? And what have the mentioned come to be known? Skids. No-one likes skids. /Reason

(Oct 29, 2013 04:16 PM)Support. Wrote:  @OP, we need more information, this question is very broad with many pitfalls to look for.

I asked for more information so I could, "Show you my muscles." Try harder.
(Oct 31, 2013 05:21 AM)Support. Wrote:  Did he ask you to say that or did, "Dick ride mode" enable itself? Everyone complains about this section for various reasons & I amongst others that have also drifted from this section believe second to moderation, or lack of it, Ubers being pedantic fucks to non-upgraded members yet more than willing to help an Ubers until the cows come home is a big problem too.

How are we supposed to teach people like this? How are we suppose to welcome any new members apart from close-minded morons who don't want to learn? And what have the mentioned come to be known? Skids. No-one likes skids. /Reason

I asked for more information so I could, "Show you my muscles." Try harder.

Excuse me ? Your drift from this section couldn't be but enhancement to this section, at least we got rid of you and your asking for help threads, I couldn't find one thread of yours sharing any knowledge.

Ironic how you're talking about the hierarchy powers, when you're the first to abuse those powers. Your threads in this section are nothing but "help" threads or "opinion" threads. you're abusing your Ub3r rank to ask question hoping to be answered since you're Ub3r. Funny wasn't that your point ?

And plus, It's legit for Ub3r members to be answered more often. Since Ub3r members are HQ users manually picked by Omni himself, which makes their threads more HQ and understandable than others.
(Oct 31, 2013 05:31 AM)Lambasoft Wrote:  Excuse me ? Your drift from this section couldn't be but enhancement to this section, at least we got rid of you and your asking for help threads, I couldn't find one thread of yours sharing any knowledge.

Lmfao. My main requests for help was with GDI & Mono.Cecil & I think you'll find, I was the first to post a Cecil thread with my findings & offered & did help people learning it too & included credits to those who helped me too.

(Oct 31, 2013 05:31 AM)Lambasoft Wrote:  Ironic how you're talking about the hierarchy powers, when you're the first to abuse those powers. Your threads in this section are nothing but "help" threads or "opinion" threads. you're abusing your Ub3r rank to ask question hoping to be answered since you're Ub3r. Funny wasn't that your point ?

So much lol.
[Image: d762ab342d.png]

Bullshit doesn't play well on the internet mate. Discussions are the collections of people(s) opinion(s). Is that not what Forums are? Void point. I never said I haven't asked for help, I'm quite proud to admit that HF users honed my VB skills. Void point. You may also find that when you think I was "abusing my power", I was either alpha or l33t (neither of witch I paid for, I was bought them for being HQ from 2 different users). Void point. And no, I didn't ask for help because I was Uber so I'd get an answer. Void point. Smh.

(Oct 31, 2013 05:31 AM)Lambasoft Wrote:  And plus, It's legit for Ub3r members to be answered more often. Since Ub3r members are HQ users manually picked by Omni himself, which makes their threads more HQ and understandable than others.

Ralf. Definitly deserved a ralf.

Look, I don't wanna hijack this thread anymore, it's deemed LQ.


Possibly Related Threads...
Thread / Author Replies Views Last Post
by HackersNov 11, 2025 09:42 AM 0 204 Nov 11, 2025 09:42 AM
Last Post: Hackers
[.NET] by EasyGh0stJul 8, 2015 02:52 PM 3 143 Jul 8, 2015 02:52 PM
Last Post: Breakbot
[C#] by InfidelJul 27, 2013 02:25 AM 5 305 Jul 27, 2013 02:25 AM
Last Post: W00dL3cs