Results 1 to 4 of 4

Thread: Seach & Replace Through .HTM Files

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2002
    Location
    Thunder Bay, ON
    Posts
    89

    Question Seach & Replace Through .HTM Files

    Oi,

    I have to write an app which will search through various "HTM" files and look for certain text and then replace it accordingly.

    I have been researching for some time I am unsure how to start this, I have a few "Search & Replace" programs but I need to make my own.

    If anyone can shed some light on this matter or point me in the correct direction I would appreciate you help.

    Thanks...
    "That is just it: you must have the devil in you to succeed in any art."

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Seach & Replace Through .HTM Files

    Well if you read the text into a string you can then use the string's Replace method, passing the search phrase and replacement phrase, to replace the text.

  3. #3
    Fanatic Member MetalKid's Avatar
    Join Date
    Aug 2005
    Location
    Green Bay, Wisconsin
    Posts
    534

    Re: Seach & Replace Through .HTM Files

    Yeah, you'd have to do it the way penagate describes. After you do a replace, you would overwrite the original file and write out the new big string all at once, flush the writerstream, and finally close it.

  4. #4
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: Seach & Replace Through .HTM Files

    One word... Regex... now its a matter of finding out what types of strings you need to find...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width