Page 1 of 1

Locating & echoing - perl regex

Posted: Fri Apr 10, 2020 9:51 pm
by Narnai
Hello!

I'm trying to use Locating & echoing functions from the Mudlet mapper, but I'm having issues guessing the right perl regex to capture the rooms.

The thing logs like this:
Name - Room name [in/or empty]Area name [number]

Which would, lets say, look like this:

Bob - Bob's kitchen [in]Bob's house [1]
Bobo - Bob's living room [in]Bob's house [1]
Rob - Bob's garden [ ]Bob's house [2]
Tom - Bob's garden [ ]Bob's house [2]


I came up with this:
(.+)\- (.+?\s*?)\[(.+)](.+)\[(\d+)]

Now, that seems to be capturing *some*, sometimes, and the mapper's script manages to echo the room numbers off of it.

(Not sure it matters, but the amount of whitespace characters between the room name and [in/empty] ranges from a lot to one - depending on the length of the room name.)

Any help would be appreciated, thanks!

Re: Locating & echoing - perl regex

Posted: Thu Apr 30, 2020 5:03 am
by SlySven
You will need to escape all four of the '[' and ']' - not just the '['s with a '\' - as they are both special characters to the regex engine unless told that they are not...