Dehumanize() inserts a space before trailing digits (v3 regression)
Author: markheathCreated Aug 26, 2026Updated Aug 27, 2026
Hi, I stumbled across a surprising change of behaviour in v3 compared to v2.
In Humanizer 2.14.1, "Item1".Dehumanize() returns Item1. However, in 3.0.1+ it returns "Item 1"
I think it is because "Item 1".Pascalize() no longer strips the space out since v3.0.1 (and Dehumanize uses Humanize().Pascalize()).
AI analysis says that this is because of a change to PascalizePattern:
In v2.14.1 - @"(?:^|_| +)(.)" - the capture group (.) matches any character
In v3.0.1+ - @"(?:[ _-]+|^)([a-zA-Z])" - the capture group is restricted to [a-zA-Z]
So could be fixed by changing the capture group to [a-zA-Z0-9] or similar
Source: Humanizr/Humanizer