Reputation: 61
any way I can split this string x+5-3+x=6+x-2
while keeping the separators, I tried regex split on [\+\-]
but this gives me, x, 5, 3, ...
and I need x, +5, -3, +x
using (?=[-+])
as in Java doesn't work.
Thanks
Upvotes: 1
Views: 93
Reputation: 2544
use FindAllString
regexp.MustCompile(`[-+\?=]?([0-9]|x)`).FindAllString("x+5-3+x=6+x-2", -1)
Upvotes: 1