Android Question [RegEx] convert this regex to works in b4x ?

Waldemar Lima

Well-Known Member
Licensed User
B4X:
pattern = "var ytInitialPlayerResponse = (.*?};)" 'one or more digits
            Dim Matcher1 As Matcher
            Matcher1 = Regex.Matcher(pattern, text)
            Do While Matcher1.Find
                Log("Found: " & Matcher1.Match)
            Loop

How do I convert this regex to work in b4x? as it is the error occurs > java.util.regex.PatternSyntaxException: Syntax error in regexp pattern near index 37

1695999126342.png
 

teddybear

Well-Known Member
Licensed User
In B4A, you need to escape the } to \}.
B4X:
pattern = "var ytInitialPlayerResponse = (.*?\};)"
 
Upvote 0
Top