first_page the funky knowledge base
personal notes from way, _way_ back and maybe today

ASP and VBScript 5.5 Code: basRowCmds(); Use of the Regular Expression Object

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

mod date: 2004-02-03T19:07:39.000Z