This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Website splitting...

Help for those learning Tcl or writing their own scripts.
Post Reply
A
Access
Voice
Posts: 22
Joined: Sun Jun 04, 2006 6:31 am

Website splitting...

Post by Access »

Ok i have a variable with the sourcecode of a html-page. Now i want to filter out some data...
the variable with the source: $source

in the source is some text like <blablabla>14:55<blublublub>
so, now i want to filter out 14:55 and "put" (sorry for bad english) it into an array, $time(1), if <blablabla>14:55<blublublub> is not just once in the source, i want to filter out all times -> $time(1), $time(2)....

Thanks for help!
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

Code: Select all

set list [regexp -all -inline {<blablabla>(\d{1,2}:\d{2})<blublublub>} $text]
set i 0
foreach {line in} $list {
   incr i
   set time($i) $in
}
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
Post Reply