### Use ReplaceAll

To replace a pattern, e.g. BB to HTML conversion, a JavaObject is required (requires the JavaObject library).
Example Pattern:
Replace "\\[b\\](.+?)\\[/b\\]" to "$1"
' JavaObject Routine to ReplaceAll using RegEx Matcher
`Sub RegExReplace(Pattern As String, Text As String, Replacement As String) As String
Dim jo As JavaObject = Regex.Matcher(Pattern, Text)
Return jo.RunMethod("replaceAll", Array(Replacement))
End Sub`
Example replacing a Pattern using a Map File
Define a map file (like bbtohtml.txt) containing the BB to HTML tag conversion:
BB Tag = HTML Tag
Fri Sep 25 16:09:41 CEST 2015
\\[break\\]=
\\[br\\]=
\\[b\\](.+?)\\[/b\\]=$1
Define the Sub to convert using the JavaObject Routine RegExReplace
`Sub BBtoHTML(bbstring As String) As String
Dim result As String = bbstring
Dim m As Map = File.ReadMap(File.DirApp, "bbtohtml.txt")
For i = 0 To m.Size - 1
result = RegexReplace(m.GetKeyAt(i), result, m.GetValueAt(i))
Next
Return result
End Sub`
Output Example:
For the string
[b]Moin Moin[/b][br]
the result is
<bold>Moin Moin</bold><br/>

Changed: , Category: RegEx, File: T6C240M1760.htm, ID: 1760