Your pattern currently consumes the leading and trailing commas, so every other value is skipped.
You need to use zero-width positive lookahead/lookbehind assertions instead:
Regular Expression Language - Quick Reference[
^]
Also, it would be better to use
[^\,]*
rather than
.*?
, since you know you want to match anything except a comma.
And finally, if you're doing string concatenation in a loop, you should use a
StringBuilder
instead.
Dim regex As New Regex("(?<=\,)([^\,]*)(?=\,)")
Dim sb As New System.Text.StringBuilder()
For Each m As Match in regex.Matches(RichTextBox1.Text)
sb.Append(m.Value)
sb.Append("|")
Next
Me.Text = sb.ToString()