Function basRowCmds(vString) If Len(vString) = 0 Then Exit Function Dim vCmdButton Dim objRegExpr: Set objRegExpr = New regexp objRegExpr.Pattern = "<\\!--cmd_(\\D+)(\\D+)(\\d+)-->" objRegExpr.Global = True objRegExpr.IgnoreCase = True Dim objMatches: Set objMatches = objRegExpr.Execute(vString) Dim objMatch: For Each objMatch in objMatches Select Case LCase(objMatch.SubMatches(0)) 'SubMatches() was added to VBScript 5.5! Case "add" vCmdButton = "<button class=""uiButton""" _ & "onClick=""window.location.href='./?cmd=add&type=" _ & objMatch.SubMatches(1) & "&id=" _ & objMatch.SubMatches(2) & "'"">Add</button>" vString = Replace(vString,objMatch.Value,vCmdButton _ ,1,-1,vbTextCompare) Case "delete" vCmdButton = "<button class=""uiButton""" _ & "onClick=""window.location.href='./?cmd=delete&type=" _ & objMatch.SubMatches(1) & "&id=" _ & objMatch.SubMatches(2) & "'"">Delete</button>" vString = Replace(vString,objMatch.Value,vCmdButton _ ,1,-1,vbTextCompare) Case "remove" vCmdButton = "<button class=""uiButton""" _ & "onClick=""window.location.href='./?cmd=remove&type=" _ & objMatch.SubMatches(1) & "&id=" _ & objMatch.SubMatches(2) & "'"">Remove</button>" vString = Replace(vString,objMatch.Value,vCmdButton _ ,1,-1,vbTextCompare) End Select Next
basRowCmds = vString
End Function