Alias using regular expressions will not parse multiple times on one line

Posted by PaperThin on Wed 08 Jun 2011 11:13 AM — 2 posts, 14,352 views.

#0
So I'm trying to figure out how to make an alias that will substitute all instances of one selection of words in favor of a selected word. I came up with the following...

<aliases>
<alias
match="^(.*?)\b(me|my|i)\b(.*?)$"
enabled="y"
regexp="y"
keep_evaluating="y"
sequence="40"
>
<send>%1thy%3</send>
</alias>
</aliases>

My problem is, for my test phrase...

i am not me, nor is my name what i say it may be.

I get...

thy am not me, nor is my name what i say it may be.

So the issue I'm having is that while it matches it once, it doesn't seem to want to match all the other instances of the same words... Even though I have keep_eval checked... What am I missing here?
USA #1
That's not what "keep evaluating" does. "keep evaluating" just allows other aliases to be checked for matches, rather than stopping at this alias. What you would've wanted is "repeat on same line", but aliases don't have that option (only triggers).

Just use scripting:
local replacements = {"me", "my", "i"}
local str = "%1"
for _,v in ipairs(replacements) do
  str = str:gsub(v, "thy")
end

Send(str)