About Us
Products
Purchase
Downloads
Support
Forums
Contact Us
Site
 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
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sat Mar 15, 2008 8:21 pm   

[2.20] subregex....sigh
 
I found a mistake in the logic of this once I could put it a more extensive set of testing. The problem actually is that the PRUNE causes the pattern to reset and the start point of the match to move 1 character forward. This was causing a pattern such as "\d+" to produce more matches then it should. For example a test string of "1234 5 6 78 9" would produce this series of matches: 1234 234, 34, 4, 5, 6, 78, 8, 9. This was not a good thing.

Sadly there is no way for me to shift the linkage between the regex and replacement to keep the calls to the replacing code to a minimum while still having access to the thinking of the regex engine. I treid everyway I could imagine to shift it around, but in the end just had to live with the extra calls and make the logic handle it right. After my changes the above pattern with a sub string of "x" properly produces "x x x x x", changing the pattern to "\d" properly produces "xxxx x x xx x".

A new file with the correections is in the mail.
_________________
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: Mon Mar 17, 2008 5:31 pm   
 
I received your updated files and will add them to the next version.

I had also noticed this behavior when testing, but I couldn't decide if this was "normal" behavior for regular expressions or not. I definitely agree that your changes make it work more like what I'd expect it to. Thanks!
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