Loading ...
Sorry, an error occurred while loading the content.

Re: regex variable

Expand Messages
  • Nikolay Pavlov
    ... is useful when searching for perl variables... ... embedding ... support. ... to get rid of the shenanigans I use to make up, for sure! ... You missed the
    Message 1 of 23 , Jul 19, 2013
    • 0 Attachment


      On Jul 19, 2013 6:37 PM, "BPJ" <bpj@...> wrote:
      >
      > 2013-07-19 16:00, Nikolay Pavlov skrev:
      >
      >> On Jul 19, 2013 5:49 PM, "BPJ" <bpj@...> wrote:
      >>>
      >>>
      >>> 2013-07-19 09:59, shawn wilson skrev:
      >>>
      >>>> On Jul 18, 2013 11:48 PM, "John Beckett" <johnb.beckett@...> 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
      >
      >
      > Perl's \Q not only quotes interpolated variables,
      > but also any metacharacters, so that \Q[]\E is equivalent to \[\], which is useful when searching for perl variables...
      >
      > The way Perl's \Q does (not) interact with \\E is indeed annoying
      >
      >
      >> (compared to escape()) substitute() call or a new function. AFAIR embedding
      >> variables was indeed requested.
      >
      >
      > Some syntax for that, like \%{varname} could be added to Vim.
      >
      >
      >>
      >> The thing I constantly miss in vim RE engine is unicode and locales support.
      >
      >
      > Yeah, but I've kind of resigned to the lack of it, but it would be nice to get rid of the shenanigans I use to make up, for sure!
      >
      > BTW I'm on a UTF-8 locale, so I seldom need (other) locales.

      You missed the point of locales. It is not about encoding, it is about language and affects ranges (what characters match a-z range depends on language you set in your locale) and a big bunch of other things I do not care about. Ranges matter for me only because ё (CYRILLIC ... LETTER IO) is not in range а-я (CYRILLIC ... LETTER A-YA), while it must be there if you are talking about Russian alphabet. For locales not to break scripts and degrade performance new regex flag have to be introduced. Python has this support, and it has it with additional flag. Do not remember about perl.

      Also note that range а-я is utterly broken with &enc set to KOI8-R.

      >
      >>
      >>> /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@....
      >>>
      >>> 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@....
      > 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@....
      For more options, visit https://groups.google.com/groups/opt_out.
       
       
    • BPJ
      ... I know, but I usually deal with languages that are so exotic or so extinct that there are no locales for them, or with such philologists tics like
      Message 2 of 23 , Jul 19, 2013
      • 0 Attachment
        2013-07-19 17:40, Nikolay Pavlov skrev:
        > You missed the point of locales. It is not about encoding, it is about
        > language and affects ranges (what characters match a-z range depends on
        > language you set in your locale) and a big bunch of other things I do not
        > care about.

        I know, but I usually deal with languages that are so exotic or so
        extinct that there are no locales for them, or with such
        philologists' tics like typesetting a language in romanization,
        yet sort it as if it were in the native script. There ain't no
        locales for that either. I'm just happy that I can get UTF-8
        I/O out of the box and that there are tools to do such sorting,
        but for the most part I've had to write my own tools. Luckily
        user-defined character properties can make up for missing ranges
        to a degree.
        (<https://metacpan.org/module/perlunicode#User-Defined-Character-Properties>),
        and ack as grepprg goes a long
        way towards having unicode-aware searching in vim.

        --
        --
        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@....
        For more options, visit https://groups.google.com/groups/opt_out.
      Your message has been successfully submitted and would be delivered to recipients shortly.