Andrew wrote:
I am tying to expand some camel case with spaces - but I want multiple captitals to remain as one word. So
I want  "PerlNotesOnXML" -> "Perl Notes On XML"

My attempt is to use [A-Z]+ in a lookahead.

  my $text = "PerlNotesOnXML" ;
  $text =~ s/(?=[A-Z]+)/ /gx ;
  print $text ;

I think I can see what is happening - [A-Z]+ matches XML then ML then L.
Is there a way of preventing it looking XML more than once.

$ perl -le'
my $text = "PerlNotesOnXML";
$text =~ s/(?<!^)([A-Z]+)/ $1/g;
print $text;
'
Perl Notes On XML



John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to