A bogus edge case in Perl regular expressions (PCRE) allows to inject newline characters at various places. This is a documented feature of PCRE, see http://www.regular-expressions.info/anchors.html#realend. So yes, this is a feature in Perl, but a bug in Wikidata that already made it into our database dumps.
Patches for review:
- https://github.com/DataValues/Common/pull/49
- https://github.com/DataValues/Geo/pull/64
- https://github.com/DataValues/Number/pull/58
- https://github.com/DataValues/Number/pull/59
- https://github.com/DataValues/Number/pull/60
- https://github.com/DataValues/Time/pull/116
- https://github.com/DataValues/Validators/pull/14
- https://github.com/wmde/WikibaseDataModel/pull/662
- https://github.com/wmde/WikibaseDataModel/pull/663
- https://github.com/wmde/WikibaseDataModelServices/pull/132
- https://gerrit.wikimedia.org/r/284724
- https://gerrit.wikimedia.org/r/284729
- … more?