in reply to Split without removing characters
$ perl -e 'my $foo = "Hello WorldFoo BarPerl MonksSlash Dot"; my @x = +split /(?<=[a-z])(?=[A-Z])/, $foo; print map("[$_]",@x),$/' [Hello World][Foo Bar][Perl Monks][Slash Dot]
Using look-behind and look-ahead tags, you end up matching a zero-width point between characters as your split point.
(PS - "bad at regexps"? I find look-behind and look-ahead are relatively rarely used, so it's just a matter of experience - and my experience on this has solely been answering questions here ;->)
|
|---|