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

136175trouble with pattern, character collections

Expand Messages
  • Marc Weber
    Feb 17, 2013
      I expect the following to output 1 (be equal), but its not. I don't understand why

      echo substitute("-D abc\nfoo/bar\n-L x", "-[DL][ ]*[^\n]*",'','g')
      \ == substitute("-D abc\nfoo/bar\n-L x", '-[DL][ ]*[^\n]*','','g')

      Why do I expect so ? because "[\n]" should be the same as '[\n]' - however
      '[\n]' should be replaced by chr(10) by the pattern interpreter according to help:

      according to :h pattern.txt /A collection. This is a sequence of characters enclosed in brackets
      - The following translations are accepted when the 'l' flag is not
      included in 'cpoptions' {not in Vi}:
      \n line break, see above |/[\n]|

      Which piece am I missunderstanding?

      Marc Weber

      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.
    • Show all 28 messages in this topic