Hi,
I've been trying to get a simple function to work, that passes in a string
and then loops through an array of words, if one of these words in in the string
it removes the word (replaces it with blank).
But for the life of me I cannot get this to work correctly, the code
needs more work to effectively remove the correct word match, but once
I can get the basics to work I can carry on with the rest
i.e:
<code>
Dim aCommonWords() as String
Dim theString as String
Dim theString = "here is a black and white cat"
// Common words to remove.
aCommonWords=Array("and","in", "the", "of", "to", "come")
// Stores the DocumentField text in the following string
Dim R as RegEx
'Initialize new regex object
R = New RegEx
'Set our regex options
R.Options.Greedy = False
R.Options.ReplaceAllMatches = True
'Set replacement string
R.ReplacementPattern = "" // Empty string
For i as Integer=0 to UBound( aCommonWords )
' Set Serach Pattern.
R.SearchPattern = aCommonWords(i)
' check for a match
if R.Search( theString ) <> Nil then theString = r.replace( theString )
Next
</code>
Thanks in advance
Mark
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>