|
xnomeda Newbie
Joined: 24 Nov 2009 Posts: 7
|
Posted: Tue Nov 24, 2009 3:55 pm
Regex help |
Hello,
This is the regex pattern that I have working in RegExBuddy
Code: |
<wielded>\s*(\(.*\) )*(.*) |
this matches
Code: |
<wielded> (Glowing) a fiery dagger
or
<wielded> (Glowing) (Magical) a fiery dagger
|
However in the trigger setup of cMUD, it doesn't seem to work, even on the testing page. (And yes, I have the 'use regular expressions' option checked)
Any suggestions? The entire object is to get the 'the fiery dagger' part into a variable for other scripts.
Also, any ideas on how to be able to read any number of (Glowing) or (Humming) etc that may be on the item into separate variables?
Thank you for your time. |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Tue Nov 24, 2009 7:22 pm |
Code: |
#trigger {^<wielded>%s~((*)~)([%w%s])} {
$ItemFlags = %replace(%subchar(%1,"()","")," ","|")
#forall "Glowing|Magical[b]|other tags you never mentioned[/b]" {
#if (%ismember(%i,$ItemFlags)) {#addkey Item %i 1} {#addkey Item %i 0}
}
item.name = %2
}
|
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
GeneralStonewall Magician
Joined: 02 Feb 2004 Posts: 364 Location: USA
|
Posted: Tue Nov 24, 2009 7:41 pm Re: Regex help |
xnomeda wrote: |
Hello,
This is the regex pattern that I have working in RegExBuddy
Code: |
<wielded>\s*(\(.*\) )*(.*) |
this matches
Code: |
<wielded> (Glowing) a fiery dagger
or
<wielded> (Glowing) (Magical) a fiery dagger
|
However in the trigger setup of cMUD, it doesn't seem to work, even on the testing page. (And yes, I have the 'use regular expressions' option checked)
Any suggestions? The entire object is to get the 'the fiery dagger' part into a variable for other scripts.
Also, any ideas on how to be able to read any number of (Glowing) or (Humming) etc that may be on the item into separate variables?
Thank you for your time. |
<wielded>\s+((?:\(.+\) ?)*) (.+)
Should work |
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|