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

Re: /^\[\w"]

Expand Messages
  • Christian Brabandt
    ... Yes, because that is what you told you RE to do. [ w ] Means match either or w or . If you want to have all letters and numbers and double quotes,
    Message 1 of 7 , Sep 18, 2013
    • 0 Attachment
      On Thu, September 19, 2013 07:10, tom arnall wrote:
      > On 9/17/13, Gary Johnson <garyjohn@...> wrote:
      >> On 2013-09-17, tom arnall wrote:
      >>> with nomagic /^\[\w"] does not get every match. it skips random
      >>> intervals of matching lines with every try. que pasa?
      >>
      >> For example, ....
      >
      > In the process of getting an example, I found that vim is skipping to
      > lines starting with 'w'. What do I say in nomagic that gets all letter
      > chars and number chars and double quote?

      Yes, because that is what you told you RE to do. [\w"] Means match either
      '\' or 'w' or '"'. If you want to have all letters and numbers and
      double quotes, try explicitly [a-zA-Z0-9"]

      regards,
      Christian


      --
      --
      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.
    • Erik Christiansen
      ... Standardising on one flavour across tools helps avoid such confusion, and the Posix ERE convention is widely used amongst text tools. In vim I d then use
      Message 2 of 7 , Sep 18, 2013
      • 0 Attachment
        On 18.09.13 22:10, tom arnall wrote:
        > On 9/17/13, Gary Johnson <garyjohn@...> wrote:
        > > On 2013-09-17, tom arnall wrote:
        > >> with nomagic /^\[\w"] does not get every match. it skips random
        > >> intervals of matching lines with every try. que pasa?
        ...
        > In the process of getting an example, I found that vim is skipping to
        > lines starting with 'w'. What do I say in nomagic that gets all letter
        > chars and number chars and double quote?

        Standardising on one flavour across tools helps avoid such confusion,
        and the Posix ERE convention is widely used amongst text tools. In vim
        I'd then use either:

        /\v[A-za-z0-9"]

        or

        /\v(\a|\d|") # OK, that uses extensions, but consistent grammar.

        If it's necessary to use BREs ("nomagic"), in order to win a bet, then
        just take out the \v and add the obfuscating backslashes which make BREs
        such a pain, e.g.:

        /\(\a\|\d\|"\)

        Erik

        --
        Tecoma's Macca's-striking flash mob: " http://www.youtube.com/watch?v=H7-0T1vbnWE
        Stop fat food joint opposite Tecoma preschool: www.change.org
        Taking democracy (98,000 signatures) from Australia to Chicago:
        http://www.abc.net.au/news/2013-09-17/tecoma-residents-take-fight-against-mcdonalds-to-chicago/4963866

        --
        --
        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.
      • Gary Johnson
        ... To elaborate a bit, you can t use backslash-escaped character classes within a collection, i.e., between [ and ]. You can, however, use named character
        Message 3 of 7 , Sep 18, 2013
        • 0 Attachment
          On 2013-09-19, Christian Brabandt wrote:
          > On Thu, September 19, 2013 07:10, tom arnall wrote:
          > > On 9/17/13, Gary Johnson wrote:
          > >> On 2013-09-17, tom arnall wrote:
          > >>> with nomagic /^\[\w"] does not get every match. it skips random
          > >>> intervals of matching lines with every try. que pasa?
          > >>
          > >> For example, ....
          > >
          > > In the process of getting an example, I found that vim is skipping to
          > > lines starting with 'w'. What do I say in nomagic that gets all letter
          > > chars and number chars and double quote?
          >
          > Yes, because that is what you told you RE to do. [\w"] Means match either
          > '\' or 'w' or '"'. If you want to have all letters and numbers and
          > double quotes, try explicitly [a-zA-Z0-9"]

          To elaborate a bit, you can't use backslash-escaped character
          classes within a collection, i.e., between [ and ].

          You can, however, use named character classes such as [:alnum:], so
          this pattern would also work:

          ^\[[:alnum:]"]

          Regards,
          Gary

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