Seach for text after a word in a text file.

Hello There - Look for word after 'Hello'

Page 1 of 1

2 Replies - 1471 Views - Last Post: 16 December 2008 - 10:49 AM Rate Topic: -----

#1 Worf  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 29-November 08

Seach for text after a word in a text file.

Post icon  Posted 15 December 2008 - 06:20 PM

Hi.

I need my application to searching a text file for a word and once found i want to be able to get what is after that word.

What i am looking for is:

U_SHELL_FOLDERS_CACHE="%USERPROFILE%\Local Settings\Temporary Internet Files"


For example:

my program will search for U_SHELL_FOLDERS_CACHE=

Now, once found i need to be able to find what is after this then display it in a textbox and to also be able to modify it.

Display and modify this line.

"%USERPROFILE%\Local Settings\Temporary Internet Files"



I can at the moment read a text file, find words and replace them then write back to the text file.


Dim Cache As String = "U_SHELL_FOLDERS_CACHE="

fileContents = My.Computer.FileSystem.ReadAllText("C:\SFE\Temp\HIVEDEF.inf")

fileContents = Replace(fileContents, Cache, USERINPUT)
My.Computer.FileSystem.WriteAllText("C:\SFE\temp\HIVEDEF.inf", fileContents, False)


USERINPUT would be a user input like. C:\My Files\Internet Cache

So when written back to the text file it would look like

U_SHELL_FOLDERS_CACHE="C:\My Files\Internet Cache"


Many Thanks for any help.


Worf

This post has been edited by Worf: 15 December 2008 - 06:59 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Seach for text after a word in a text file.

#2 Jayman  Icon User is offline

  • Student of Life
  • member icon

Reputation: 418
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: Seach for text after a word in a text file.

Posted 15 December 2008 - 06:33 PM

[rules][/rules]
Was This Post Helpful? 0
  • +
  • -

#3 Worf  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 29-November 08

Re: Seach for text after a word in a text file.

Posted 16 December 2008 - 10:49 AM

So no one can help?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1