C#: How to replace "-" with " -" only when it's not preceded by "e"?

Posted by MaDDoX on Stack Overflow See other posts from Stack Overflow or by MaDDoX
Published on 2012-03-18T17:59:11Z Indexed on 2012/03/18 18:03 UTC
Read the original article Hit count: 175

Filed under:
|
|

I imagine I should use Regex for that but I still scratch my head a lot about it (and the only similar question I found wasn't exactly my case) so I decided to ask for help. This is the input and expected output:

Input: "c-0.68219,-0.0478 -1.01455-0.0441 0.2321e-4,0.43212" Output:"c -0.68219,-0.0478 -1.01455 -0.0441 0.2321e-4,0.43212"

Basically I need either commas or spaces as value separators, but I can't break the exponential index (e-4). Maybe do two successive replacements?

© Stack Overflow or respective owner

Related posts about c#

Related posts about regex