I am trying to remove the number from a string and add trailing 0s to make it 4 digit where neccessary:

hello123 = 0123
jonsmith7nm = 0007
hellodolly5678 = 5678

This is what i have (taken from a CF script writen a long time ago!):

Set oRegExp = New RegExp
oRegExp.Global = True

oRegExp.Pattern = "[^\d\r\n]"
s = oRegExp.Replace(s, "")

oRegExp.Pattern = "^[0]{1,3}"
s = oRegExp.Replace(s, "")

response.Write(s)

The first bit works but not the second! Any help?

cheers