Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

/Tools/RegEx/Test RegEx2
Function:
Required plugins for this example: MBS Tools Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Tools/RegEx/Test RegEx2
This example is the version from Sun, 17th Mar 2012.
Project "Test RegEx2.rbp"
FileTypes
Filetype text
End FileTypes
Class Window1 Inherits Window
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action() resultField1.text = RegExMBS_ReplaceAll(targetField.text, searchField1.text, replaceField.text) resultField2.text = RegExMBS_ReplaceAll(targetField.text, searchField2.text, replaceField.text) resultField3.text = RegExMBS_ReplaceAll(targetField.text, searchField3.text, replaceField.text) End EventHandler
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
Control StaticText3 Inherits Label
ControlInstance StaticText3 Inherits Label
End Control
Control StaticText4 Inherits Label
ControlInstance StaticText4 Inherits Label
End Control
Control targetField Inherits TextArea
ControlInstance targetField Inherits TextArea
End Control
Control searchField1 Inherits TextField
ControlInstance searchField1 Inherits TextField
End Control
Control replaceField Inherits TextField
ControlInstance replaceField Inherits TextField
End Control
Control resultField1 Inherits TextArea
ControlInstance resultField1 Inherits TextArea
End Control
Control searchField2 Inherits TextField
ControlInstance searchField2 Inherits TextField
End Control
Control Line1 Inherits Line
ControlInstance Line1 Inherits Line
End Control
Control Line2 Inherits Line
ControlInstance Line2 Inherits Line
End Control
Control searchField3 Inherits TextField
ControlInstance searchField3 Inherits TextField
End Control
Control resultField2 Inherits TextArea
ControlInstance resultField2 Inherits TextArea
End Control
Control resultField3 Inherits TextArea
ControlInstance resultField3 Inherits TextArea
End Control
Control Line3 Inherits Line
ControlInstance Line3 Inherits Line
End Control
Control StaticText5 Inherits Label
ControlInstance StaticText5 Inherits Label
End Control
Control Separator1 Inherits Separator
ControlInstance Separator1 Inherits Separator
End Control
Control StaticText6 Inherits Label
ControlInstance StaticText6 Inherits Label
End Control
Control StaticText7 Inherits Label
ControlInstance StaticText7 Inherits Label
End Control
Control StaticText8 Inherits Label
ControlInstance StaticText8 Inherits Label
End Control
Protected Function RegExMBS_ReplaceAll(targetStr as string, searchStr as string, replaceStr as string) As String dim r as new RegExMBS dim strLF, res as string r.CompileOptionMultiline = true r.CompileOptionUngreedy = false if r.Compile(searchStr) then strLF = ReplaceLineEndings(targetStr,EndOfLine.UNIX) res = r.ReplaceAll(strLF,replaceStr) res = ReplaceLineEndings(res,EndOfLine) else res = targetStr end if return res End Function
End Class
Class App Inherits Application
End Class
MenuBar MenuBar1
MenuItem UntitledMenu1 = ""
MenuItem FileMenu = "&File"
MenuItem FileQuit = "Quit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu0 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "Clear"
End MenuBar
End Project

See also:

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS Tools Plugin.




Links
MBS Xojo tutorial videos