Converemon
New Member
- Joined
- May 23, 2014
- Messages
- 15
I need help creating a function to compare strings; probably using regular expressions since it is a bit tricky. We have six strings:
String 1: "V06+K73+U55+M67"
String 2: "!M43"
String 3: "!U67"
String 4: "V06"
String 5: ""
String 6: ""
In this case, "!" means 'not' so this statement would evaluate to True. There will always be five columns of substrings, but any number of them can be blank. If they are, they should return True as well. The above should return False only if it had "!K73" or "D44" or something similar. I use this to test my regular expressions:
But I really don't think it will cut it for this. I have also tried variations of "Like" and "InStr" but it just doesn't work. Does anyone have any suggestions?
String 1: "V06+K73+U55+M67"
String 2: "!M43"
String 3: "!U67"
String 4: "V06"
String 5: ""
String 6: ""
In this case, "!" means 'not' so this statement would evaluate to True. There will always be five columns of substrings, but any number of them can be blank. If they are, they should return True as well. The above should return False only if it had "!K73" or "D44" or something similar. I use this to test my regular expressions:
Code:
Function Test_traMLFB(sMLFB, sPattern) As Boolean
Dim RegX As Object
Dim RegMC
Set objRegX = CreateObject("VBScript.RegExp")
With objRegX
.Pattern = sPattern
If .Test(sMLFB) Then
Set RegMC = .Execute(sMLFB)
Test_traMLFB = True
Else
Test_traMLFB = False
End If
End With
End Function
But I really don't think it will cut it for this. I have also tried variations of "Like" and "InStr" but it just doesn't work. Does anyone have any suggestions?