Archive: Looking for a Line Replacing Function. Word ANYWHERE, Replace Entire Line


Looking for a Line Replacing Function. Word ANYWHERE, Replace Entire Line
I've been looking for something like this and I cannot find it. I need a function that will open a file for writing. It is looking for any word which means the word does not have to be[list=1][*]on a line by itself[*]starting the line off[/list=1]
It seems every function I've come across on the archives in no way happens to do what I am trying to get done. I am simply trying to find a word in a file and then replace that words entire line.

This word can and will be 99% of the time[list=2][*]NOT on a line by itself[*]NOT starting the line off[/list=2]
I've tried working on my own script to accomplish this but it seems I can only get as far as replacing the word ONLY if it is on a line by itself. Can someone help lend me a hand on this please. World of thanks!

PS. I'd like to call this task the Afrow UK challenge. Sorry Afrow ;)


I feel I should be a bit more descriptive with the kind of function I am seeking.

major thanks to anyone who can help with this :)

Here is that function created by the man ;)

http://nsis.sourceforge.net/archive/...91&instances=0


search the forums for WordFunc and TextFunc header files.

${WordFind}/${WordFind2X} and ${LineFind}/${LineRead} will do the trick.


Thanks Comm@nder21, I got it ;)


vbgunz, the 2nd function you requested is ready. I shall upload it to the Archive now.

-Stu


http://nsis.sourceforge.net/archive/...ances=0,11,311

It's a big function, but it works a brute!

-Stu


Amazing, Thank a mill!


Yak! I am certain the Function does as expected and I don't want you to change it so can you add a new Function with the ability to CopyBetween?

Ultimately, I was looking for a way to CopyBetween and put the copy into $0 and then use $0 as the value to ReplaceBetween. You understand?

Sorry if I mentioned it with misunderstanding. I do prefer though after looking at your function that they do stay seperated. Sharp.

File1
<yadda>
This is found in file1 and will be copied. A backup file exist and it is sort of like a database. It will basically serve so many different purposes.
<yadda />

File2
<yadda>
This is found in file1 and will be copied. A backup file exist and it is sort of like a database. It will basically serve so many different purposes.
<yadda />


I understand. I shall make a similar function called GetBetween.
Meanwhile, I updated the ReplaceBetween function to make it a tiny bit faster.

-Stu


Ok here it is:
http://nsis.sourceforge.net/archive/...ances=0,11,311

-Stu


Superb, you're indeed an NSIS pimp to be reckoned with. Thanks 2 mill ;)