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

RE: match(), regexp problem

Expand Messages
  • Zdenek Sekera
    ... ... ... Where did my . go ?? I knew I must not see something obvious! ... Beauty, thanks!
    Message 1 of 3 , May 3, 2005
    • 0 Attachment
      > > 012345678
      > > let z="a[q]x[qq]"
      ...
      ...
      > > echo matchstr(z, '\[*\]$')
      > > returns ']' which is indeed the 8th char.
      > > What did it do with the rest of my regexp?
      > > I wanted to get all between [...], closing
      > > bracket to be last on the line, so I expected
      > > '[q]x[qq]'.
      >
      > Possibly what you want is
      > echo matchstr(z,'\[.*]$')
      >

      Where did my . go ??
      I knew I must not see something obvious!

      ...
      > Then I suppose you want
      >
      > echo matchstr(z,'\[[^[]*]$')

      Beauty, thanks!

      ---Zdenek
    Your message has been successfully submitted and would be delivered to recipients shortly.