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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
alluran
Adept


Joined: 14 Sep 2005
Posts: 223
Location: Sydney, Australia

PostPosted: Tue Jan 09, 2007 2:49 pm   

SubRegex Workarounds Anyone?
 
Heres the working function from zmud with %1 and %2 replaced with $input and $color respectively
Code:
%subregex( $input, "((?:[^a-zA-Z0-9]|^)+)([a-zA-Z0-9/-/:])([a-zA-Z0-9]*)", %char( 37)1~@%upper( $color)%char( 37)2~@%lower( $color)%char( 37)3%char( 37)4)

Unfortunately, I can't get this to work at all, and would REALLY like it to, so any help would be appreciated

Its meant to turn
Quote:
@highlight(Some Text,R)
into
Quote:
@RS@rome @RT@rext


I used to do it with a recursive function, but that was worse, it crashed cmud

Thanks
_________________
The Drake Forestseer
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Tue Jan 09, 2007 3:15 pm   
 
The variables in the last argument should be %1..%99, if you want the matches from the regex pattern. Also, you should have it in quotes (as per the documentation) to prevent early evaluation of the expression. I found that %subregex doesn't seem to save the values into %1..%99 as it should, however, so you may not get it working even with the correct syntax. Just a heads up.
Reply with quote
alluran
Adept


Joined: 14 Sep 2005
Posts: 223
Location: Sydney, Australia

PostPosted: Tue Jan 09, 2007 11:48 pm   
 
Yeah, thats what i meant, this was the final syntax that i used to make it work in zMud, after trying and realising that the %1-%99 vars arent being saved for the subregex, so does anyone perhaps have another way of doing this in a function syntax?
_________________
The Drake Forestseer
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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