gametechmods
Robot Arena => Tutorials and Tips => Other Tutorials => Topic started by: philetbabe on September 24, 2009, 03:25:04 AM
-
Question : how to add something in the beginning of each line of a file.
Answer : Use search and Replace and Regular Expression.
For instance, imagine you're named ACAMS and you need to add " to the front of each line
here are the regular expressions to use (GUI is Frnech, regular expression is international ):
search : ^(.*)$ : which mean all the line
replace : "\1 : which mean the line prefixed by "
be aware to check 'regular expression'
(https://gametechmods.com/uploads/images/28927notepadRepl.png)
result if applied to a file event.txt :
"0
"F.O.R.C.E. Tournament
"<text font fg_mcn14>The bot association, Friends of Robotic Combat Events, began this tournament as a refuge for young robot builders scolded by critics of violent pastimes.</text>
"4
"Arenas\event_results\prizes\Fruit_Punch\Fruit_Punch.gmf
"<text font fg_mcn14>You didn't win, but all participants receive a free six-pack of Fruity-Punch.</text>
"Arenas\event_results\prizes\Vacation_Photo\vacation_photo.gmf
"<text font fg_mcn14>At least you won the first round. You won an autographed photo of the beautiful supermodel, Glenda Goodsmile.</text>
"Arenas\event_results\prizes\VCR_Series\VCR_Series2.gmf
"<text font fg_mcn14>Hey, pretty good. You won two rounds! You won the video casette series, 'How to Build a Robot in Metal Shop Class Without the Teacher Finding Out.'</text>
"Arenas\ev
...
-
And to add text to the end of the line you simply put the text after \1
Here are the regular expressions to use
search: ^(.*)$ (which mean all the line is selected)
replace with: \1Text goes here (put any text or link)
Be sure to check 'regular expression'
You may have to trim trailing blank spaces, or you will get a space between the last word and your text, unless you want a space.
(https://gametechmods.com/images/inserttext.png)