| Steve Jenkins 2006-10-21, 7:03 pm |
| I am having a problem matching the beginning of words using regexp, at
least it is not working as I expect. Here is an example:
% set a {this is a test thathb}
this is a test thathb
% regexp -inline -all {\mth[a-z]} $a
thi tha thb
I would have expected only "thi" and "tha" to be returned as "thb" is
part of "thathb" and not at the beginning of the word. When I do the
following command, I get what I expect (but then the \m is not actually
necessary):
% regexp -inline -all {\mth[a-z]*} $a
this thathb
However, if I do the following command, it does work as I expect (note
there is only one "th" at the end, not two):
% regexp -inline -all {\mt[a-z]} $a
th te th
In place of "\m" I have also tried [[:<:]] with the same results. Looks
like something is disabling the \m function in the first command above.
What am I missing? (Oh, and I am using ActiveTcl 8.4.13.0 on Windows.)
|