How to get the last word

I would need to know the word before the cursor, in order to choose the right action to perform. So, for example, if the word is “leg” or “reg”, the suffix “eg” must be added to the word, otherwise if the suffix “eg” is already in the word, it must be changed to “et”. Something like this:

if(word = 'leg') > outs(word) 'eg'
if(word = 'reg') > outs(word) 'eg'
'eg' > 'et'

I know that variables used in if statements cannot be output. So is there another solution? Is it possible to use DLLs? I read the DLL documentation, but I didn’t understand much. Is there any example somewhere?

Thanks

Sorry, I solved it by myself:

store(letters) 'A' .. 'Z' 'a' .. 'z'

notany(letters) 'leg' > 'legeg'
notany(letters) 'reg' > 'regeg'
'eg' > 'et'

Thank you for providing the solution here. It is very useful for other users to read.

Please feel free to create a new topic if there is any question.

This topic was automatically closed after 14 days. New replies are no longer allowed.