Reputation: 2221
I am splitting a string using this regex expression.
inputSplit = Regex.Split(temp, @"([/+-/*x/÷///²/√])")
This expression should split on +-*x÷/²√.This works perfectly except when I put in a decimal. If i do 1 + .002 it splits into 1, +, ., 002. Which i cant find out why its splitting the decimal from the .002. I assume its maybe one of my special characters? Thanks
Upvotes: 2
Views: 85
Reputation: 20024
I think you need to revise your expresion probably missing \
next to -
([+\-*x÷²√])
This I think is returning your expected results:
var results = Regex.Split("1+.002", @"([+\-*x÷²√])", RegexOptions.None);
Upvotes: 4