Blonde moment...
Before I try and do it a harder way, can anybody remind me how to get
the desired from the following? I simply want to split
"aTypicalCamelCasePropertyName" into a "a Typical Camel Case Property
Name" (fully expanding upper-case blocks as the simplest answer to the
ambiguity)
Console.WriteLine(Regex.Replace(
@"testInputOfWhatIWantUPPERS",
@"([a-zA-Z])([A-Z])",
@"$1 $2"));
I want: "test Input Of What I Want U P P E R S"
I currently get: "test Input Of What IWant UP PE RS" - i.e. the upper-
case is getting consumed each time.
Any offers?
Marc
Jesse Houwing - 15 Aug 2007 14:38 GMT
Hello Marc,
> Blonde moment...
>
[quoted text clipped - 14 lines]
>
> Marc
Make the first group a Look behind, so that is is not part of the match.
Then only insert a space before the found character like so:
> Console.WriteLine(Regex.Replace(
> @"testInputOfWhatIWantUPPERS",
> @"(?<=[a-zA-Z])([A-Z])",
> @" $1"));
--
Jesse Houwing
jesse.houwing at sogeti.nl
Marc Gravell - 15 Aug 2007 14:57 GMT
Perfect; much obliged
Marc