|
Rehcra Novice
Joined: 10 Oct 2000 Posts: 43
|
Posted: 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 |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: 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. |
|
|
|
Rehcra Novice
Joined: 10 Oct 2000 Posts: 43
|
Posted: 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. |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: 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. |
|
|
|
|
|