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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Fri May 09, 2008 8:54 pm   

[2.25] %pat is officially broken in %subregex
 
Even the example from the documentation doesn't work, so I don't feel so bad now that I can't make my slightly more complicated call work. The %subregex just returns empty/null strings for any %pat now.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Fri May 09, 2008 8:58 pm   
 
Yep, subregex was rewritten, and I haven't gotten the full documentation writen for it yet.

You can see my post "Initial subregex documentation" for all of the new features, and also should check the comments for subregex that I wrote for 2.20.

I am aiming at having a good help document done this weekend.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Wed May 21, 2008 7:54 pm   
 
Yes, and to summarize the solution for others, you need to use \1 .. \99 to refer to subpatterns in the substitution string, just like with normal regular expression substitutions. The %pat function won't work in a substitution string anymore.

Also, using \1..\99 instead of %pat is faster. If your substitution string contains @ or % characters, then CMUD will try to compile it and execute it to expand variables or functions. Using \1..\99 performs the substring substitution internally within the regex routines without calling the CMUD parser, so it is much faster.

The reason %pat doesn't work is that it normally fetches subpatterns from the internal CMUD execution stack, and that execution stack is not being used by the PCRE subregex routine.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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