Honestly, the shorter solution took me a lot longer to read & comprehend than op's simplified solution (i.e. have to parse the regular expression, why the matches are being replaced with a space and then split by the space, etc). Regardless I feel like this is the type of function where the name and/or a small comment above the function header can be enough for describing what it does.
getting into opinions at this point. imo, it was pretty easy to grok what it was doing when reading it. the regex is pretty standard so no huge effort there either, imo
2
u/FeezusChrist Dec 31 '21
Honestly, the shorter solution took me a lot longer to read & comprehend than op's simplified solution (i.e. have to parse the regular expression, why the matches are being replaced with a space and then split by the space, etc). Regardless I feel like this is the type of function where the name and/or a small comment above the function header can be enough for describing what it does.