Dear Stackoverflow,
I have a nice CamelCase string such as ImageWideNice
or ImageNarrowUgly
. Now I want to break that string in its substrings, such as Image
, Wide
or Narrow
, and Nice
or Ugly
.
I thought this could be solved simply by
camelCaseString =~ /(Image)((Wide)|(Narrow))((Nice)|(Ugly))/
But strangely, this will only fill $1
and $2
, but not $3
.
Do you have a better idea for splitting that string?