Reputation: 1
I am trying to get specific string using regex in VB.NET.
Below is my code
The number 8538 is what I want.
However, I can only get full string, {"pushToken":"8538"} , which is not what I want.
Please tell my what I am doing wrong.
Thanks a lot.
Dim pushToken As String = "{""pushToken"":""8538""}"
Dim pattern = "{""pushToken"":""(.*)""}"
Dim match As Match = Regex.Match(pushToken, pattern)
pushToken = match.Value
Upvotes: 0
Views: 73
Reputation: 174706
match.Value
would print the matched string only, in-order to print the chars which are at the group index 1, you need to call match.Groups(1).Value
pushToken = match.Groups(1).Value
Upvotes: 1