I want to replace all non-alpha characters in a string with a plus ‘+’ sign, but making sure that a group of more than one non-alpha chars is only replaced by one plus sign.
I had thought the following might work but apparently not:
System.Text.RegularExpressions.Regex.Replace(name, @'[^\w]*?', '+')
Try System.Text.RegularExpressions.Regex.Replace(name, @’\W+’, ‘+’)
For this: ‘sasa-==[]&^asdsa2435′ matches -==[]&^