Meh, so much for late night half-sleeping cleaning up code...
`[ \t\r\n]` should have been `[ \t\r\n\f]`, to follow http://www.w3.org/TR/2008/REC-CSS2-20080411/syndata.html#whitespace . `\s` "[m]atches a single white space character, including space, tab, form feed, line feed and other unicode spaces", so a different, bigger set than wanted (and not sure `[ \t\r\n]` is rightfully noted as equal to `\s` in MDN).

The single regexp for removing outer spaces looks interesting, did not read or even think of that, but than `.` might not catch any `\n` etc. which could be, at least by syntax, appear in the middle of the name. `([^]*?)`might be answer, hm. Thinking about the next minutes, thanks for the idea.