This is hideously bad code, but it works on the first example you gave.
VB Code:
Option Explicit Private Sub Form_Load() Dim strExample As String Dim str1 As String Dim str2 As String Dim str3 As String Dim slash As String strExample = "Original problem gets listed, it's usually a fairly short string. XXX Problem gets some sort of update text. XXX Maybe some more update text gets added here. /// Then they close the problem report for that particular entry like this." str1 = Left$(strExample, InStr(strExample, "XXX") - 1) str2 = Mid$(strExample, InStr(strExample, "XXX") + 3, InStrRev(strExample, "XXX") - (InStr(strExample, "XXX") + 3)) If InStr(strExample, "///") > InStr(strExample, "\\\") Then slash = "///" Else slash = "\\\" End If str3 = Right$(strExample, Len(strExample) - InStr(strExample, slash) - 2) Debug.Print str1 Debug.Print str2 Debug.Print str3 End Sub
Also works for example in post #3 (with the last XXX removed).




Reply With Quote