Dim pStr: pStr="UserID:1|UserName:allanc|UserTitle:Mr|UserFirstName:Allan|"
Dim sFind: sFind="UserID"
Dim matches,match,i
Set matches = RegExpr_ReturnMatch(pStr,sFind & ":([^|]+)",True)
If matches.Count > 0 Then
For Each match In matches
Response.Write match.Value & "<br>"
[HL="#FFFF80"] If match.SubMatches.Count > 0 Then
For i=0 To match.SubMatches.Count-1
Response.Write match.SubMatches(i) & "<br>"
Next ' submatch
End If[/HL]
Next ' match
Else
Response.Write "Not found in the string<br>"
End If
Function RegExpr_ReturnMatch(sOriginalString, sPattern, bIgnoreCase)
Dim objRegExp: Set objRegExp = New RegExp
With objRegExp
.Pattern = sPattern
.IgnoreCase = bIgnoreCase
.Global = True
End With
Set RegExpr_ReturnMatch=objRegExp.Execute(sOriginalString)
Set objRegExp = Nothing
End Function