B4A Library String Functions

vbmundo

Well-Known Member
Licensed User
Hi
I have problem with example
B4X:
Dim text, pattern As String
text = "any text*any text*any text*"
pattern = "*" 'one or more digits
Dim Matcher1 As Matcher
Matcher1 = Regex.Matcher(pattern, text)
Do While Matcher1.Find
  Log("Found: " & Matcher1.Match)
Loop
When pattern is any character then works ok, but when I search "*" then compiler give below error, why ?

java.util.regex.PatternSyntaxException: Syntax error in regexp pattern near index 1:

Generally I want find all position "*" in string and extract text between two stars : *text*

Thanks
Boguslaw
Try to use "\*" to find, and language recognize as Literal and not special character.
 
Top