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 

working with multiple RegExp Matches

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


Joined: 12 Apr 2010
Posts: 1

PostPosted: Mon Apr 12, 2010 3:32 pm    Post subject: working with multiple RegExp Matches Reply with quote

hi,

im writing a small website parsing tcl script. my question is how i can handle with multiple regexp matches? how can i work with every single match or how to put these in a variable?
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Mon Apr 12, 2010 3:43 pm    Post subject: Reply with quote

I'd use something along these lines:
Code:
set matches [regexp -inline -all -- {some pattern} data]
foreach {match submatch1 submatch2 ...} $matches {
 #do something useful for each match here...
}

Just make sure the variable-list in foreach matches the matchVar+subMatchVar set you'd normally use (when not using -inline).
_________________
NML_375, idling at #eggdrop@IrcNET
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