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

Re: regexp match

Expand Messages
  • Tony Mechelynck
    ... From: Denis Perelyubskiy To: Vim Sent: Tuesday, September 27, 2005 10:19 PM Subject: regexp match
    Message 1 of 5 , Sep 27 1:43 PM
    • 0 Attachment
      ----- Original Message -----
      From: "Denis Perelyubskiy" <lists@...>
      To: "Vim" <vim@...>
      Sent: Tuesday, September 27, 2005 10:19 PM
      Subject: regexp match <script></script>


      > hello,
      >
      > how do I match <script>(something here)</script>, where (something here)
      > does not contain any other <script> tags and can span multiple lines?
      >
      > along the same lines, I tried:
      > <script\_.*<\/script>, but did not know how to make the match stop on
      > the first <\/script> (i tried \(<\/script>\)\{-}, but somehow that did
      > not do what I wanted.
      >
      > Also, I did not know how to exclude <script> from the \_.* match. I
      > tried changing this to something like this:
      > <script\_.*\(<script>\)\{0}\_.*<\/script>
      >
      > Perhaps I am going about it completely the wrong way. Is this even
      > possible?
      >
      > thanks!
      >
      > -d
      > --
      > // mailto: Denis Perelyubskiy <lists at overwhelmTAKECAPITALSOUT dot net>
      > // icq : 12359698

      Including the tags:
      /<script>\zs\_.\{-}\ze<\/script>
      <script>
      matches itself
      \zs
      set start-of-match here
      \_.
      anything including an end-of-line
      \{-}
      repeated zero or more times, as few as possible
      \ze
      set end-of-match here
      <\/script>
      matches </script>

      However, the above pattern doesn't handle mismatched or embedded tags: it
      matches from any opening tag to the first closing tag that follows it.


      Best regards,
      Tony.
    Your message has been successfully submitted and would be delivered to recipients shortly.