' Collection of code snippets by Arne Vajhøj 
' (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
'before = "ROUA1SEK123456P333.pdf"
before = WScript.Arguments(0)
Set re = New RegExp
re.Pattern = "^(ROUA1SEK)(\d{6})(P)(\d{3})(\.pdf)$"
re.Global = True
Set mm = re.Execute(before)
Set m = mm.Item(0)
after = "RWW000RT" & m.SubMatches(1) & "101A" & m.SubMatches(3) & ".pdf"
Set m = Nothing
Set mm = Nothing
Set re = Nothing
WScript.Echo before
WScript.Echo after
Set shell = CreateObject("WScript.Shell")
shell.run "cmd /c rename " & before & " " & after
Set shell = Nothing
