Pavel Minaev
8/4/2008 6:32:00 AM
On Aug 3, 6:54 pm, "Alexander Vasilevsky" <m...@alvas.net> wrote:
> There is a phone number in a string such as "3223223" to format it as a
> "322-32-23", using regular expressions. Is it possible?
Regular expressions are used to parse strings, not to format them. Can
you clarify why you think you need them here?
In the specific case that you give, what's wrong with this:
var result = string.Format("{0}-{1}-{2}", input.Substring(0, 3),
input.Substring(3, 2), input.Substring(5, 2));