Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ Alias using regular expressions will not parse multiple times on one line

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

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by PaperThin   (1 post)  Bio
Date Wed 08 Jun 2011 11:13 AM (UTC)
Message
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?
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #1 on Wed 08 Jun 2011 04:34 PM (UTC)

Amended on Wed 08 Jun 2011 04:39 PM (UTC) by Twisol

Message
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)

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


11,406 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.