Matching "[ ] ;

Posted by TruckDriver22 on Fri 20 Feb 2009 06:26 AM — 6 posts, 25,961 views.

Denmark #0
This is my promt

222H 22V 2222X 2C [Truckdriver:v.good] [Nick Gammon:Good] Exits:E(W)>

No matter how i try i cant get nothing to match the [ ] :

and this is what it looks like if your assisting someone

222H 22V 2222X 2C [Truckdriver:v.good] [Thetank:Awful] [Nick Gammon:Good] Exits:E(W)>

Some times it needs to match ' - , in there to.! like

[Truck'son the half-elf] but i just want it to see if i am tanking or assisting. so i am not sure if that will matter.
Amended on Fri 20 Feb 2009 06:31 AM by TruckDriver22
USA #1
If you are using regular expressions, you need to escape the '[' character because otherwise it counts as a character class. To escape it, use '\['.
Denmark #2
Thanks that helped sum but i still need help with matching the words inside the [] i was using (.+) to match the inside parts

[Truck'son the half-elf]
USA #3
It would be helpful to show your trigger, so that we can see what we're working with. :-)
Australia Forum Administrator #4
When you started this thread, amongst other things, the new thread header asked for:


A literal copy of the trigger (there is a Copy button) - see http://www.mushclient.com/copying for exact details.


Asking for help with a trigger, without showing what you have attempted, makes it very hard to know what you are doing.
Denmark #5
^(\d+)H (\d+)V (\d+)X (\d+)C \[Me\:(.+)\] \[(.+)\:(.+)\] \[(.+)\:(.+)\] Exits(.+)

t0 match if not tanking does not work

^(\d+)H (\d+)V (\d+)X (\d+)C \[Me\:(.+)\] \[(.+)\:(.+)\] Exits(.+)

this is to match tanking