I have a suggestion regarding [regexp] with -all option. According to
the documentation: "If this is specified with match variables, they
will contain information for the last match only."
My question is, wouldn't it be beneficient to include all matched
instances into the match variable instead of only the last one. The
match variable can be a list containing the matched instances or even
an array name.
So that using for instance:
regexp -all "\[0-9]+" "abc1def2...xyz9" match
we have the list {1 2 ... 9} inside the var match.
I think this will help especially in case that it is not easy to
predict the length of the "string" or how it is constructed, and we
need to match some keywords.
If others Tcl'ers see this useful as well, perhaps this enhancement can
be included in a future release. Or may be there are other (better)
ways, I'm not aware of, to perform the same task.
Thank u all for yr help and comments.
Rgrds
Khaled
> regexp -all "\[0-9]+" "abc1def2...xyz9" match
> we have the list {1 2 ... 9} inside the var match.
set match [regexp -all -inline "\[0-9]+" "abc1def2...xyz9"]
--
Donald Arseneau as...@triumf.ca