Andrew schreef:
> 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.

echo "<PerlNotesOnXML>" | perl -pe'
  s/(?<=[a-z])(?=[A-Z])/ /g
'
<Perl Notes On XML>

-- 
Affijn, Ruud

"Gewoon is een tijger."


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


Reply via email to