Wednesday, January 15, 2014

Re: Copy the matched substring only with :g

2014-01-15 15:42, Paul Isambert skrev:
>>> - I've replaced \l\u with \(\l\u\|\u\l\), otherwise words starting
>>> with an uppercase letter won't be found.
>>
>> Why so? Doesn't the \a* take care of it?
>
> No, there no way for '\a*\l\u\a*' to match on e.g. "Initial": if the first \a
> matches, then there is nothing left for \u; if that \a doesn't match, then the
> first letter must match \l, and that won't work either.

Yeah, I realized right after I hit Send.

>
> By the way, what I've sent you will only copy the first match of each line. If
> you wanted all camelcased words to be copied, it'll need further work.

No worries, I found a method which worked :-)

:$!perl -nlE'say for /\pL*\p{Ll}\p{Lu}\pL*|\b\p{Lu}\p{Ll}*\b/g' %

In both cases I got a lot of cruft as well as what I looked for,
but at leas I could now `vip:sort u` and scan some 20 lines
of hits instead of trying to spot them scanning the whole file...

Thanks anyway!

/bpj

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: