Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Thunderbuster
Novice


Joined: 07 Nov 2001
Posts: 45
Location: USA

PostPosted: Sun Aug 18, 2002 5:42 am   

[?]123,456,789 Pattern matching
 
How can you match a pattern like this and assign it to a varable. The best I am coming up with is &%dvar1,&%dvar2,&%dvar3 then I assign it like this: varable=@var1~,@var2~,@var3
I am certain there is a better way to capture the pattern and assign it to a varable. I am running into a problem when the number to match has this pattern 1,234,567,890. The leading 1 doesn't want to assign to varable, so I am looking to do it the correct way.

Thanks


2nd place just means your a 1st place loser.
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Sun Aug 18, 2002 5:46 am   
 
Try using %x:

#TRIGGER {coming up with is (%x) then I assign} {#VAR varable %1}
#SH coming up with is 1,234,567,890 then I assign
#SH I captured: @Varable

Ton Diening
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Aug 18, 2002 6:32 am   
 
Since you weren't very specific on the line you want to match then I must assume you want to generically match a number with commas in it. Try this.

#TR {([0..9,])} {varable="%1"}
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun Aug 18, 2002 3:39 pm   
 
You can match the pattern with %n.

LightBulb
Senior Member
Reply with quote
LEit
Novice


Joined: 27 Jul 2002
Posts: 38
Location: USA

PostPosted: Mon Aug 19, 2002 2:54 pm   
 
If you need to strip the ,'s you can use %replace(@var,",","")
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net