Debugging Challenge
Just a regular expression (F#)
1 min readMay 4, 2020
Previously on Dr. Lambda’s blog: I have devised a series of debugging challenges, some are easy, some are really hard, all come from real live systems. Good luck!
The Challenge
- 1 point if you can spot where the error is.
- +1 point if you can explain why.
- +2 points if you can explain how to fix it.
let csv_split seperator str =
let csvSplit = new Regex(
"((?:\")[^\"]*(?:\"(?=,|$)+)|(?<=,|^)[^,\"]*(?=,|$))",
RegexOptions.Compiled) in
csvSplit.Matches(str)
.OfType<Match>()
.Select(fun m -> m.Value.TrimStart(','))
.ToArray()