On Sun, 2008-11-23 at 11:52 +0000, 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.
> 
> 

How would it parse "XMLSchema" ?  You need to write down the rules
before you try creating than regex for them.  Try:

1.  If there is a capital letter followed by one or more lowercase
letters, then they all make one word.

2.  If there is a string of uppercase letters at the end of a string, it
is a word.

3.  If there is a string of uppercase letters followed by lowercase
ones, there are two words; the first is all the uppercase but one, the
second is that uppercase letter and the lowercase ones.


-- 
Just my 0.00000002 million dollars worth,
  Shawn

The map is not the territory,
the dossier is not the person,
the model is not reality,
and the universe is indifferent to your beliefs.


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


Reply via email to