chrjs
chrjs

Reputation: 2443

Regex - Works on every Regextester, but not in my vb.net application

i got the following regex, which is working on some regex testers out there flawlessly. (for example www.regextester.com)

I want 1 item with "500", 1 with "600" and 1 with "-100".

    Dim matches As MatchCollection
    Dim regex As New Regex("(\d+)\s\/\s(\d+)\s\((\-?\d+)\)")
    matches = regex.Matches("500 / 600 (-100)")

My matches.count is one, with the complete string. Nothing else.

Any ideas?

Thanks in advice.

Upvotes: 2

Views: 78

Answers (2)

Kev Hunter
Kev Hunter

Reputation: 2625

You have one match with three groups.

what result are you expecting?

Upvotes: 0

Daniel Mann
Daniel Mann

Reputation: 59016

You have 1 match, with 3 groups. Check matches(0).Groups(1) through matches(0).Groups(3)

Upvotes: 3

Related Questions