Friday, July 19, 2013

Re: regex variable


On Jul 19, 2013 5:49 PM, "BPJ" <bpj@melroch.se> wrote:
>
> 2013-07-19 09:59, shawn wilson skrev:
>
>> On Jul 18, 2013 11:48 PM, "John Beckett" <johnb.beckett@gmail.com> wrote:
>>>
>>>
>>> shawn wilson wrote:
>>>>
>>>> This is probably a feature request but I really do hate the
>>>> regex engine and would love to swap it out. Is there / can
>>>> there be a compile time option to use a different engine?
>>>
>>>
>>> No (I assume you want different regex syntax, probably PCRE).
>>>
>>
>> libpcre would be fine, yes. Or the library that Ruby uses - either way.
>
>
>> Yeah, it looks like sed's syntax. If I'm used to writing things one way
>> (say in code) and then hit '/' to do a similar thing inside my editor,
>> switching mindset constantly makes me loose my thought (generally what
>> happens) or make stupid errors like earlier in this thread.
>
>
> I feel the same sometimes, as I code Perl in Vim on a daily
> basis, but Vim's (old) regex engine/syntax actually allows useful
> things which are impossible or hard inn Perl, not only the other
> way around. And I can always filter through a perl oneliner if I
> want to use perl's regex engine. Can't you do the same with Ruby?
> Vim regexes come closer to Perl's if you use of \v and so that
> ought to bring you closer to PCRE too unless the "PC" is now only
> an historical leftover (I haven't looked at the specs in a long
> time, but hey) The only thing I regularly miss in Vim regexes is
> \Q...\E. \V...\v comes close, although you still have to escape
> your backslashes under \V.
>
> So I guess I should file a feature request for support of \Q,
> although someone probably has already...

To have this a way to embed variable is needed in first place. Otherwise you would need to escape \E which can only be done with a more complex (compared to escape()) substitute() call or a new function. AFAIR embedding variables was indeed requested.

The thing I constantly miss in vim RE engine is unicode and locales support.

> /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.
>
>

--
--
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:

Post a Comment