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
deathkitty
Apprentice


Joined: 14 Apr 2008
Posts: 105

PostPosted: Sun May 31, 2015 2:20 pm   

Trouble with a regex
 
How would I go about capturing a room name like this (not wanting the " [E]" bit):
Code:
Atop a Stone Arch [E]


I tried this:
Code:
^(.*) +\[([.*])+\]$

and then for the pattern to match #TAG name %1 as the room name and the second one #TAG exit %2 as roomexits

After having read the CMUD #regex help file and a tutorial http://www.proftpd.org/docs/howto/Regex.html but still can't get a match, I tried in the testing window and that doesn't work either, I guess I'm probably doing something wrong that someone that actually knows what they are doing would see straight away maybe? *hopes* :S

Bunch of edits by Vijilante cause necroing old topics to ask a question is not cool.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Mon Jun 01, 2015 4:46 am   
 
Both should work, but I would recommend the second version which is narrower.
Code:
^(.*) \[(.*)+\]$
Code:
^(.*) \[([NSEWUD]*)+\]$
You should still reconfigure, and you may need to adjust the exit detection settings by checking the single character option.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
deathkitty
Apprentice


Joined: 14 Apr 2008
Posts: 105

PostPosted: Thu Jun 18, 2015 5:56 am   
 
Thanks a lot :)

Do you know how I'd add in the possibility of directions being encased in brackets? (this is how a door is marked apparently with eoemud.com I don't know if other muds which say they are Diku muds are the same or something) also sometimes there is a Q in the room exits to mean quit and that throws off the pattern, even the default CMUD configurator gets confused when there's a Q in the room exits too :S

I know for normal CMUD trigger I'd use {|Q} to match either nothing or Q, and the same with putting brackets around every letter just in case they have (like ~[{|~(}{|N}{|~)}{|~(}{|E}{|~)}{|~(}{|S}{|~)}{|~(}{|W}{|~)}{|~(}{|D}{|~)}{|~(}{|U}{|~)}~] or something like that, but anything that isn't a regex trigger seems to go a bit crazy when there's square brackets in patterns quite often, even when they are escaped with the squiggles)

Inside the Greasy Bastard [NS(U)Q]

The Back of the Bastard [(N)SD]

Avasar's Stables [NEQ]
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sat Jun 20, 2015 12:32 pm   
 
Code:
^(.*) \[([NSEWUDQ\(\)]*)+\]$
I think #TAG will still work correctly even when the exit information contains strange stuff. You may want to do some parsing on your own and use the #DOOR command to create doors as you go.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
deathkitty
Apprentice


Joined: 14 Apr 2008
Posts: 105

PostPosted: Tue Sep 08, 2015 10:08 am   
 
Thanks a lot for the reply, I really appreciate it, um, it's matching the name now when I check the Pattern tab in the package editor to test it, it is definitely matching the room name now, but for some reason it doesn't seem to be affecting the mapper in any way and it's still putting the whole thing (room name with the directions in the room name, which isn't what is matched in the test) in the room name as well as the room name and exits into the first line the desc

(I'm also only able to get a match for the first part ( #tag name %1 ) but not for the second part ( #tag exit %2 ) for some reason)

Thank you for any help and sorry for the slow reply
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4525
Location: Pensacola, FL, USA

PostPosted: Wed Sep 09, 2015 1:54 am   
 
Did you reconfigure the mapper after adding/changing any mapper related triggers?
_________________
Discord: Shalimar#3679
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