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

RegEx help

Expand Messages
  • Kunal Bajpai
    The string is (including double quotes) - John Travolta Samuel Jackson I want RegEx that searches the above string and treats John Travolta (between quotes)
    Message 1 of 2 , Sep 1, 2010
    • 0 Attachment
      The string is (including double quotes) - "John Travolta" Samuel
      Jackson

      I want RegEx that searches the above string and treats John Travolta
      (between quotes) as one string and Samuel & Jackson as the other 2
      string.

      Thus,
      String 1 = John Travolta
      String 2 = Samuel
      String 3 = Jackson

      Actually, I have to use the RegEx in a function where "space" is a
      delimiter and splits a string into sub-strings

      TIA
      Kunal

      --
      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
    • Adam
      This should do it. Obviously I m just doing a basic substitution so you can alter as you need to.
      Message 2 of 2 , Sep 1, 2010
      • 0 Attachment
        This should do it.  Obviously I'm just doing a basic substitution so you can alter as you need to.

        s/"\(John\s\+Travolta\)"\s\+\(samuel\)\s\+\(jackson\)/\1\r\2\r\3/i

        ~Adam~


        On Wed, Sep 1, 2010 at 12:00, Kunal Bajpai <kunal.bajpai@...> wrote:
        The string is (including double quotes) - "John Travolta" Samuel
        Jackson

        I want RegEx that searches the above string and treats John Travolta
        (between quotes) as one string and Samuel & Jackson as the other 2
        string.

        Thus,
        String 1 = John Travolta
        String 2 = Samuel
        String 3 = Jackson

        Actually, I have to use the RegEx in a function where "space" is a
        delimiter and splits a string into sub-strings

        TIA
        Kunal

        --
        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 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
      Your message has been successfully submitted and would be delivered to recipients shortly.