Dim m As Matcher
m=Regex.matcher("BTC---Bitcoin---(.*),ETH---Ethereum---(.*),","BTC---Bitcoin---0.5,ETH---Ethereum---15,")
m.find
Log("bitcoin:"& m.Group(1))
Log("eth:"& m.Group(2))' - - - - -
From the type documentation, exactly what you want: Split (Pattern As String, Text As String) As String()
Splits the given text around matches of the pattern.
Note that trailing empty matches will be removed.
Example:
Dim components() As String
components = Regex.Split(",", "abc,def,,ghi") 'returns: "abc", "def", "", "ghi"
You can replace the "-" with blanks using string replace method.
sorry, I misread the first post. you want all 3 of them not only the value.
then use this...
B4X:
Dim m As Matcher
m=Regex.matcher("(.*)---(.*)---(.*)","BTC---Bitcoin---0.5,ETH---Ethereum---15,".Replace(",",CRLF) )
Do While m.find
Log(m.Group(1) &" "& m.Group(2) &" "& m.Group(3))
Loop
Waiting for debugger to connect...
Program started.
BTC Bitcoin 0.5
ETH Ethereum 15
sorry, I misread the first post. you want all 3 of them not only the value.
then use this...
B4X:
Dim m As Matcher
m=Regex.matcher("(.*)---(.*)---(.*)","BTC---Bitcoin---0.5,ETH---Ethereum---15,".Replace(",",CRLF) )
Do While m.find
Log(m.Group(1) &" "& m.Group(2) &" "& m.Group(3))
Loop
Waiting for debugger to connect...
Program started.
BTC Bitcoin 0.5
ETH Ethereum 15