On 01/07/09 00:03, Nathan Neff wrote:
>
>> :echo substitute(string, '\.\zs\A\|\a\zs\l', '', 'g')
>
> Thanks Tony. I ended up modifying it a bit -- I put the + quantifier
> after the \l, and I removed the \. because it was keeping the _ and .
> chars in the
> result.
>
> Here's my tweaks to your suggestion:
>
> let string="FruitCompanyController_foo_bar_quk.groovy"
> echo substitute(string, '\a\zs\l\+\|\zs\A', '', 'g')
>>> FCCfbqg
>
> Thanks again!
>
> --Nate
Hm.
Adding \+ after \l is the right thing to do, I think; it matches any
number of consecutive noninitial lowercase in one fell swoop.
AFAIK, with this regexp the second \zs (after \|) isn't necessary. Then
adding a * after the \A may (or may not - it's a guess) make it work
faster on strings containing many clustered nonalpha.
If your string starts with a nonalphabetic character, you'll remove it
(because you removed the . I put to try and test for it) but maybe you
don't care about that. If you do, you may want to study
:help E59
:help /zero-width
and what they resend to.
Also, please be aware of the fact that _bottom_-posting is preferred on
this list.
Best regards,
Tony.
--
What sane person could live in this world and not be crazy?
-- Ursula K. LeGuin
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---