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
Rehcra
Novice


Joined: 10 Oct 2000
Posts: 43

PostPosted: Fri Sep 03, 2004 6:42 pm   

Need Regex Help w/ Room/Exit lines
 
OK. I've been banging my head against this, and when I think I get it fixed, I find that in truth it isn't. I've tried reading the REGEX docs which have pointed me closer, but...

I'm trying to tag the Room name, which works but it also ends up tagging the exit line, under some cases.

/The Southern Cellblock of Despair [Underground Passage]/
/In the Underground Market [Underground]/

should match as room names, returning the name in %1, and the room type in %2

/^(.+) [(.*)]$/ does fine matching these. But then we get to exits.

/ [Exits: north south west ]/ <- Fails above. (After I changed to using (.+) above.)

/ [Exits: north [east] south [west] ]/ <- Passed above, when it shouldn't.
%1 = / [Exits: north [east] south /
%2 = /[west] /

[east] signifies a closed door. You will also see /east\ for a water room, but I don't think it will matter, and a few others.

I've thought about turning off the roomname trigger each time, but haven't had a chance to play with that online yet.

Thanks for any help.
Rehcra
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Sep 03, 2004 7:10 pm   
 
Did this the easy way. Made a regular pattern that did what you asked and converted it.

^(\a+.*)[(.*)]$
_________________
LightBulb
Senior member

Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious.
Reply with quote
Rehcra
Novice


Joined: 10 Oct 2000
Posts: 43

PostPosted: Fri Sep 03, 2004 7:34 pm   
 
Thanks. Sadly. I couldn't figure out how to make it work as a regular pattern either.
I've been away to long.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Sep 03, 2004 8:02 pm   
 
Limited wildcards are the key. The Room Title lines start with alpha characters and the Exits lines start with [. So, any wildcard which matches alpha characters but doesn't match punctuation should work.
^(%w*) ~[(*)~]$
_________________
LightBulb
Senior member

Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious.
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