Nice Howard... I was trying to figure out how to use the regex replace thing, but never really got anywhere...

Here is how I was going at it, although it never quite worked right...

function a($l,$p,$m,$f)
dim $b,$c,$d,$e,$i,$j,$s,$
$=CreateObject("VBScript.RegExp")
$.Global = 1
$.Pattern="\w"
$e=split($p,",")
;? $m ?
for $j=1 to len($m)
if $i=$l
$b=$b+$l
if $.Execute(substr($m,$j+1,1)).count=0
$s=$s+1
endif
$i=0
endif
$c=substr($m,$j,1)
if $.Execute($c).count
$d=substr($m,$b+$e[$i]+$s,1)
if $s
$s=0
endif
if $.Execute($d).count=0
$d=substr($m,$b+$e[$i]-1,1)
endif
$a=$a+$d
if $.Execute(substr($m,$j+1,1)).count=0
$b=$b+1
endif
$i=$i+1
else
$a=$a+$c
endif
next
endfunction