"diablo" <di****@noplace.com> wrote in message
news:CT******************@newsfe5-win.ntli.net...
Hi
if i have a string with comma seperated words. is there a way to search
another string for words that are in it?
thanks
Kal
Which string does "it" refer to?
Will the following help?
<%
Option Explicit
Const string1 = "a,string,with,comma,seperated,words"
Const string2 = "This is a sentence with many words."
Dim i
Dim array1
array1 = Split(string1,",")
Dim results
results = ""
results = results & "'string1' = " & string1 & vbCrLf
results = results & "'string2' = " & string2 & vbCrLf & vbCrLf
results = results & "Words from 'string1' contained in 'string2':"
Dim regular
Set regular = New RegExp
regular.Pattern = "\w+"
regular.IgnoreCase = True
regular.Global = True
Dim matches
Set matches = regular.Execute(string2)
Dim matched
For Each matched in matches
For i = 0 To UBound(array1)
If matched = array1(i) Then
results = results & vbCrLf & vbTab & matched
End If
Next
Next
Set matches = Nothing
Set regular = Nothing
Response.Write results
%>