egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Inverting regsub's functions

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Fill
Halfop


Joined: 18 Jan 2009
Posts: 80

PostPosted: Wed May 06, 2009 10:55 am    Post subject: Inverting regsub's functions Reply with quote

Hey guys,

I'm using regsub to check if a variable matches a regular expression and if it does, regsub will replace the part that matches by what I want and assign that to a new variable

however, I wanted to make the opposite. I want regsub to assign the part of the variable that matched the regular expression to a variable. How can I do this?
Back to top
View user's profile Send private message
Papillon
Owner


Joined: 15 Feb 2002
Posts: 724
Location: *.no

PostPosted: Wed May 06, 2009 2:03 pm    Post subject: Reply with quote

Use Regexp
Code:
set txt SomeTextHere
regexp -all {Text} $txt new

$new will contain the match, in this case "Text"
_________________
Elen sila lúmenn' omentielvo
Back to top
View user's profile Send private message MSN Messenger
Fill
Halfop


Joined: 18 Jan 2009
Posts: 80

PostPosted: Fri May 08, 2009 7:52 am    Post subject: Reply with quote

ahmmm, nice, thanks a lot!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 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


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber