Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

regular expression on tcl Index package

0 views
Skip to first unread message

hai1001

unread,
Mar 9, 2004, 12:10:03 PM3/9/04
to
I would like to produce a report on all of our tclIndex file, but I stuck at
one bit of info. If a var $line is read from a file, it content:
"set auto_index(tcl_module_proc) [list SourceFilter [file join $dir
tcl_module.tcl]]"

I am able to get string "tcl_module_proc" in var $b by regular expression
command like:

regexp {.*\((.*?)\)((.*)([ ]*tcl)(.*))} $line a b c d e

but I haven't find out the way to extract file name "tcl_module.tcl" yet.
Any one can help?

Thanks in advance,
...hai


hai1001

unread,
Mar 9, 2004, 1:36:51 PM3/9/04
to
I got it works as:
regexp {.*\((.*?)\)((.*\$dir\s*(\w+.tcl)))} $line a b c d e
thanks,
-hai
"hai1001" <ha...@hotmail.com> wrote in message
news:c2ktmg$q7h$1...@tribune.mayo.edu...

Bryan Oakley

unread,
Mar 9, 2004, 1:54:48 PM3/9/04
to
hai1001 wrote:

Why not consider a different approach? Simply eval each of the lines,
then do the equivalent of a parray on auto_index.

To answer your specific question though, this seems to work:

regexp {auto_index\((.*?)\).*\m(\w+\.tcl)} $line match a b

that is, search for "auto_index(", grab everything up to the next ")",
skip over everything until we find the start of a word, a bunch of word
characters, and the literal string .tcl.

hai1001

unread,
Mar 9, 2004, 3:09:54 PM3/9/04
to
Your both suggestion and syntax are excellent, I will try and learn your
suggestion about eval each line, we have many tclIndex files from different
directories, I try to create a report, and hope it will list all
procedure(s) and its associated file(s).
Thanks for your help,
-hai

"Bryan Oakley" <br...@bitmover.com> wrote in message
news:Ypo3c.8608$AJ7....@newssvr23.news.prodigy.com...

0 new messages