Index: openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl,v diff -u -N -r1.189.2.154 -r1.189.2.155 --- openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl 7 Nov 2022 13:34:34 -0000 1.189.2.154 +++ openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl 8 Nov 2022 09:55:39 -0000 1.189.2.155 @@ -2477,13 +2477,16 @@ # way confusion through replacement of deleted content # with new stuff is avoided. + set str_length [string length "${str}${replace_with}"] set number 2 foreach name $existing_names { - if { [regexp "${str}${replace_with}(\\d+)\$" $name match n] } { - # matches the foo-123 pattern - if { $n >= $number } { set number [expr {$n + 1}] } + if {[string range $name 0 $str_length-1] eq "${str}${replace_with}"} { + set n [string range $name $str_length end] + if {[string is integer -strict $n] && $n >= $number} { + set number [incr n] + } } }