Sorry about my earlier post. I should have tested first. I have no clue why it does not work. Other than possible solutions provided by TCL_no_TK methodology, the only way I can get the thing to work is by using a regexp with the actual character in question inside grouping elements ([ and ]), as follows :-
[16:27] <@arfer> % return [regexp -- {[¤]} "bla bla bla bla bla ¤"]
[16:27] <@Baal> 1
What really puzzles me is why none of the following will work :-
[16:29] <@arfer> % return [regexp -- {¤} "bla bla bla bla bla ¤"]
[16:29] <@Baal> 0
[16:29] <@arfer> % return [regexp -- {.*¤.*} "bla bla bla bla bla ¤"]
[16:29] <@Baal> 0
[16:35] <@arfer> % return [regexp -- {\xA4} "bla bla bla bla bla ¤"]
[16:35] <@Baal> 0
[16:36] <@arfer> % return [regexp -- {[\xA4]} "bla bla bla bla bla ¤"]
[16:36] <@Baal> 0
Anyway, the answer to your original query would be :-
Code: Select all
if {([regexp -- {[¤]} $rname]) || ([string length $rname] > 45)} { .... }
I think!
I wouldn't mind some sort of explanation for this myself. Where is our friend nml375 when we need him?