TinTin++ Mud Client The TinTin++ message board

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
TinTin++ Mud Client

Trying to remove a bunch of (XX) at start of a line

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Script Help
View previous topic :: View next topic  
Author Message
new_to_tin_tin



Joined: 05 Jan 2011
Posts: 36

PostPosted: Sun Mar 19, 2017 5:05 pm    Post subject: Trying to remove a bunch of (XX) at start of a line Reply with quote

I'm trying to take a variable that has text like this:
(Invis) (Hidden) (Translucent) (Golden Aura) (White Aura) A mob is here.

and just extract this part into a var:
"A mob is here."

It seems I should be able to do this with the #regex command, but can't figure it out. Anyone have any ideas how to remove any number of (xxx) from the start of a string?
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Sun Mar 19, 2017 10:00 pm    Post subject: Reply with quote

%* is a lazy match and you need a greedy match for this so instead of (%*) use ({.*})

You embed a real regular expression by placing something within { } braces. So {.*} is the equivalent of (.*) while %* is the equivalent of (.*?)

#regex {(Invis) (Hidden) (Translucent) (Golden Aura) (White Aura) A mob is here.} {({.*}) %*} {#showme [&2]}
Back to top
View user's profile Send private message Send e-mail
new_to_tin_tin



Joined: 05 Jan 2011
Posts: 36

PostPosted: Tue Mar 21, 2017 8:03 pm    Post subject: Reply with quote

Thanks this worked great. I was confused the part of the manual that said ( ) are treated as normal text, unless within braces, but that braces are replaced by ( )....But I've never been good at regex anyways...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Script Help All times are GMT - 5 Hours
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
Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads
TinTin++ Homepage

Powered by phpBB © 2001, 2002 phpBB Group