Skip to content
Tcl Source Code Artifact [188d6b6d88]
Login

Artifact [188d6b6d88]

Artifact 188d6b6d88fc5cdb9bbdf56582cbbbea03d7495f:

Ticket change [188d6b6d88] - New ticket [3063568fffffffff|3063568fff] <i>regsub example doesn&#39;t perform as advertized</i>. by jaspertheperson on 2010-09-10 11:57:18.
D 2010-09-10T11:57:18
J assignee pvgoran
J cmimetype text/plain
J comment It's\sthis\sone:\n===========================================\nConvert\sall\snon-ASCII\sand\sTcl-significant\scharacters\sinto\s\\u\sescape\ssequences\sby\susing\sregsub\sand\ssubst\sin\scombination:\n\n#\sThis\sRE\sis\sjust\sa\scharacter\sclass\sfor\severything\s"bad"\nset\sRE\s{[][{};#\\\\\\$\\s\\u0080-\\uffff]}\n\n#\sWe\swill\ssubstitute\swith\sa\sfragment\sof\sTcl\sscript\sin\sbrackets\nset\ssubstitution\s{[format\s\\\\\\\\u%04x\s[scan\s"\\\\&"\s%c]]}\n\n#\sNow\swe\sapply\sthe\ssubstitution\sto\sget\sa\ssubst-string\sthat\n#\swill\sperform\sthe\scomputational\sparts\sof\sthe\sconversion.\nset\squoted\s[subst\s[regsub\s-all\s$RE\s$string\s$substitution]]\n\n===========================================\nThe\sRE\sfor\s"bad"\scharacters\sincludes\s\\s\swhich\smatches\sall\swhitespace\scharacters\sincluding\snewline.\sHowever,\sinserting\s\\\sbefore\snewline\sbefore\scalling\ssubst\son\sa\sstring\scontaining\sit\sdoes\snot\spreserve\sthe\snewline,\sit\scauses\sit\sto\sbe\sreplaced\sby\sa\sspace,\sso\sthe\swhole\sprocedure\sreplaces\snewlines\swith\s\\u0020\n\nNot\ssure\show\sto\sget\sthis\sto\swork\sproperly!\sLittle\shelp?
J foundin obsolete:\s8.6b1
J is_private 0
J priority 5\sMedium
J resolution None
J status Open
J submitter jaspertheperson
J subsystem 43.\sRegexp
J title regsub\sexample\sdoesn't\sperform\sas\sadvertized
J type Bug
K 3063568fffffffffffffffffffffffffffffffff
U jaspertheperson
Z 77b66b7de97ec50794358cd65774ea89