[help] replacing words

Post Reply
herbert
Posts: 16
Joined: Mon May 11, 2015 4:47 pm

[help] replacing words

Post by herbert »

So I been trying to code something to replace certain words in a sentance for what I TYPE.

Example I type

GT Hello, How is everyone?

for it to send

GT greetings, How is everyone?

So it'll replace hello with greeting. The part im having issues with is, IF Hello is the third word in the sentence such as, gt oh, my, hello, how are you? for it still replace hello with greetings.

Anyone have a clue how I could go about this?

the hello and greeting are examples and I would like to add more words to replace other words so to speak.

Drevarr
Posts: 43
Joined: Tue Aug 06, 2013 12:07 am
Location: GA, USA

Re: [help] replacing words

Post by Drevarr »

how about gsub?
Code: [show] | [select all] lua
str = string.gsub(matches[2], "Hello", "Greetings")
send("GT "..str)

herbert
Posts: 16
Joined: Mon May 11, 2015 4:47 pm

Re: [help] replacing words

Post by herbert »

oh, string.gsub, Thanks!

Post Reply