I have create a Regular Expression that will work if it has to but would like to refine it down a little more if I can. Here is what I have so far.
Assume this is the contents of lstrKeywords (include crlf):
SUBJ=Testing
RET=238826
RET=247142
DTD=Affidavits
!!
I am sending RET= to the value of lstrFieldName and the delimiter can be anything.
I want to use the RegExp to eliminate the crlf and the RET= (whatever is in lstrFieldName). I can't figure out if is possible to exclude them using the Regexp. So if the Delimiter is a "~" and all other variables are as discussed the function would return "238826~247142~". Can someone confirm or deny the possiblity of this??
Thanks
Code:
Public Function gloGetKeywordValues(lstrKeyWords As String, lstrFieldName As String, DelimitBy As String) As String
Dim lRegExp As RegExp
Dim lMatches As MatchCollection
Dim lMatch As Match
Set lRegExp = New RegExp
lRegExp.Pattern = "(" & lstrFieldName & ")[^\n]*\n"
lRegExp.IgnoreCase = True
lRegExp.Global = True
Set lMatches = lRegExp.Execute(lstrKeyWords)
gloGetKeywordValues = ""
For Each lMatch In lMatches
gloGetKeywordValues = gloGetKeywordValues & DelimitBy
Next
End Function
SUBJ=Testing
RET=238826
RET=247142
DTD=Affidavits
!!
I am sending RET= to the value of lstrFieldName and the delimiter can be anything.
I want to use the RegExp to eliminate the crlf and the RET= (whatever is in lstrFieldName). I can't figure out if is possible to exclude them using the Regexp. So if the Delimiter is a "~" and all other variables are as discussed the function would return "238826~247142~". Can someone confirm or deny the possiblity of this??
Thanks