Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '====================================================================
- Private Function GetMatches(ByRef Data As WORK_DATA) As Boolean
- Dim RE As New RegExp
- On Error Resume Next
- RE.Global = True
- RE.IgnoreCase = True
- RE.MultiLine = True
- RE.Pattern = "(/\*@ )(.*?)( @\*/ )(.*?)( /\*@\*/)"
- Set Data.Matches = RE.Execute(Data.Text)
- If Err.Number <> 0 Then
- ajpErr.ErrorDisplay Err, vbCritical, , "Не удалось распарсить текст файла."
- GetMatches = False
- Else
- GetMatches = True
- End If
- End Function
- '====================================================================
- Private Function ModifyText(ByRef Data As WORK_DATA) As Boolean
- Dim TMP As Long
- Dim NewValue As BStr
- Dim OldText As BStr
- OldText = Data.Text
- For TMP = Data.Matches.Count - 1 To 0 Step -1
- NewValue = Data.Matches(TMP).SubMatches(0) & _
- Data.Matches(TMP).SubMatches(1) & _
- Data.Matches(TMP).SubMatches(2) & _
- ApplyVariable(Data.Matches(TMP).SubMatches(1), Data) & _
- Data.Matches(TMP).SubMatches(4)
- 'MsgBox "*** Before:" & CRLFCRLF & _
- Mid(Data.Text, Data.Matches(TMP).FirstIndex + 1, Data.Matches(TMP).Length) & CRLFCRLF & _
- "*** After:" & CRLFCRLF & _
- NewValue
- Data.Text = Left(Data.Text, Data.Matches(TMP).FirstIndex) & NewValue & _
- Mid(Data.Text, Data.Matches(TMP).FirstIndex + Data.Matches(TMP).Length + 1)
- Next TMP
- Data.TextWasModified = CBool(Data.Text <> OldText)
- ModifyText = True
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement