thanks Ben.

I miss perl on the ability to comment liekt his:

...

$dataline=~(/
        \s*
        (\w+)       #wanted value
        \s*
        =       #=
        \s*{\s*
            (.*?)   #cli
        \s*}\s*
        (?:
            (?:     #either followed by ptn(s)
            :       #:
            \s*{\s*
                (.*?)   #ptn1
            \s*}
            (?:     #ptn2 or nothing
                :
                \s*\{\s*
                    (.*?)   #ptn2
                \s*\}\s*
            |           #or...
            \s*         #nothing
            )
            )
            |       #or
            \s*     #no ptns at all
        )
      /x)



On 08/06/2012 11:48 AM, Ben Fritz wrote:
On Sunday, August 5, 2012 10:02:13 PM UTC-5, ping wrote:
experts:

how to comment a long regex?

it looks normal line continuation doesn't work here -- I have to put

everything in one line, which becomes painful as it goes long...



   syn region erxLog

                 \start=/^\(\S\S\+.\{0,45}\S[#>%]\s*\S\+\|slot

\d\d\=->\S\+\|->.\+\|\*-\*-\*-\*-\*-\)/

                 \end=/^\(\S\+.\{0,45}\S[#>%]\|^[#>%]$\|->\|slot

\d\d\=->\|\*-\*-\*-\*-\*-\)/me=s-1 fold


The only way I know of is to build a string and then use :exe on the string 
rather than giving the command directly, e.g.

let pattern='apples'      " apples are healthy
let pattern.='\|bananas'  " and bananas are delicious
exec 'syn match ILikeToEat /'.pattern.'/'


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

Reply via email to