R RichardN Well-Known Member Licensed User Longtime User Sep 19, 2015 #1 This was extremely useful to replace ALL instances of a certain Regex pattern in B4A. Code: Copy Sub RegexReplace(Pattern As String, Text As String, Replacement As String) As String Dim m As Matcher m = Regex.Matcher2(Pattern, Regex.MULTILINE, Text) Dim jo As JavaObject = m Return jo.RunMethod("replaceAll", Array(Replacement)) End Sub How can it be translated for B4i ?
This was extremely useful to replace ALL instances of a certain Regex pattern in B4A. Code: Copy Sub RegexReplace(Pattern As String, Text As String, Replacement As String) As String Dim m As Matcher m = Regex.Matcher2(Pattern, Regex.MULTILINE, Text) Dim jo As JavaObject = m Return jo.RunMethod("replaceAll", Array(Replacement)) End Sub How can it be translated for B4i ?
JanPRO Well-Known Member Licensed User Longtime User Sep 19, 2015 #2 https://www.b4x.com/b4i/help/regularexpressions.html#regex_replace Upvote 0
R RichardN Well-Known Member Licensed User Longtime User Sep 19, 2015 #3 Thanks JanPRO. Amazed to find a topic that is simpler in B4i than in B4A. The code above can be replaced by: Text = Regex.Replace2("^(.+)\:", Regex.MULTILINE, Text, "\{b}$1\:{b}") 'Add embolden tags where desired Upvote 0
Thanks JanPRO. Amazed to find a topic that is simpler in B4i than in B4A. The code above can be replaced by: Text = Regex.Replace2("^(.+)\:", Regex.MULTILINE, Text, "\{b}$1\:{b}") 'Add embolden tags where desired
Erel B4X founder Staff member Licensed User Longtime User Sep 20, 2015 #4 RichardN said: Amazed to find a topic that is simpler in B4i than in B4A. Click to expand... Actually I think that B4i is simpler than B4A (because of the differences between the platforms). Upvote 0
RichardN said: Amazed to find a topic that is simpler in B4i than in B4A. Click to expand... Actually I think that B4i is simpler than B4A (because of the differences between the platforms).