Hi ho, I have the following problem. I can do this thing but I want to see an elegant solution, as you'll see my regex's are a bit agricultural.
mud input below;
Level: 3 Shield Mana: 5 Learned: 100% ( 72)
Mental barrier Mana: 5 Learned: 100% (126)
my regex to match this is in this trigger;
<triggers>
<trigger
group="su4"
match="^Level\:\s{1,3}(\d){1,3}(.*)Mana\:\s{1,4}(\d){0,3}\s{3}Learned\:\s{1,3}(\d+)\%\s\(\s{0,2}(\d+)\)$"
name="su4build"
regexp="y"
send_to="12"
sequence="100"
>
<send>ArrayCreate ("su4")
if %4 > 72 then
ArraySet ("su4",(string.lower(Trim("%2"))),"0")
end -- if
</send>
</trigger>
</triggers>
The issue is that it only matches the first line (with shield) and I'd like it to match either case, that being the line that starts with Level: or without Level:, but I'd like to do it properly. The regex expression I've worked just plain looks ugly, I'm sure there's a better way.
This thing is part of my fast spell up script for aardwolf mud and works a treat, but I have to add some spells manually to the array (via an alias) which is fine but My crash test dummy objects to the extra effort, as she should.
As always, thanks for the help.
Fletchling
mud input below;
Level: 3 Shield Mana: 5 Learned: 100% ( 72)
Mental barrier Mana: 5 Learned: 100% (126)
my regex to match this is in this trigger;
<triggers>
<trigger
group="su4"
match="^Level\:\s{1,3}(\d){1,3}(.*)Mana\:\s{1,4}(\d){0,3}\s{3}Learned\:\s{1,3}(\d+)\%\s\(\s{0,2}(\d+)\)$"
name="su4build"
regexp="y"
send_to="12"
sequence="100"
>
<send>ArrayCreate ("su4")
if %4 > 72 then
ArraySet ("su4",(string.lower(Trim("%2"))),"0")
end -- if
</send>
</trigger>
</triggers>
The issue is that it only matches the first line (with shield) and I'd like it to match either case, that being the line that starts with Level: or without Level:, but I'd like to do it properly. The regex expression I've worked just plain looks ugly, I'm sure there's a better way.
This thing is part of my fast spell up script for aardwolf mud and works a treat, but I have to add some spells manually to the array (via an alias) which is fine but My crash test dummy objects to the extra effort, as she should.
As always, thanks for the help.
Fletchling