------解决方案-------------------- Function ReplaceTest( strPatrn, ItemInfo ) Dim regEx Dim str Dim patrnArry Dim patrn Dim replStr Dim nRTCount Dim nArrayCount
str = "" patrn = "" replStr = "" nArrayCount = 1
patrnArry = split( strPatrn, " " )
For nRTCount = 0 To UBound( patrnArry ) If IsEmptyString( Trim( patrnArry( nRTCount ) ) ) = false Then replStr = replStr & "<font color='red'>$" & nArrayCount & "</font>" nArrayCount = nArrayCount + 1 End If Next
For nRTCount = 0 To UBound( patrnArry ) If IsEmptyString( Trim( patrnArry( nRTCount ) ) ) = false Then patrn = patrn & "(" &Trim( patrnArry( nRTCount ) ) & ")|" End If Next
patrn = mid( patrn, 1, len( patrn ) - 1 )
Set regEx = New RegExp regEx.Pattern = patrn regEx.IgnoreCase = True regEx.Global = True ReplaceTest = regEx.Replace(ItemInfo, replStr)