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

RegExp for removing large content sections

Expand Messages
  • Elryn
    Hello all, I ve been an EditPlus user for close to 2 years, and I consider myself at least a somewhat experienced regexp user. I got stumped for the first
    Message 1 of 2 , Feb 28 1:51 PM
    • 0 Attachment
      Hello all,

      I've been an EditPlus user for close to 2 years, and I consider
      myself at least a somewhat experienced regexp user. I got stumped
      for the first time today.

      I'm trying to convert a bunch of .htm's done by UI folks using
      Dreamweaver 4 to .asp's. DW4 embedded "library" content into all
      the .htm's, which will now be contained in an asp include. So, I'm
      trying to convert:

      <!-- #BeginLibraryItem "blah_library.lbi" -->...lines of content...<!-
      - #EndLibraryItem -->

      to

      <!-- #include "blah_include.asp" -->

      When I tried the following regexp, however, it didn't work.

      <\!\-\- #BeginLibraryItem "blah_library\.lbi" \-\->.*<\!\-\-
      #EndLibraryItem \-\->

      Each half, before and after the .*, works fine for hitting the tags
      themselves. But the .* chokes. I tried replacing it with [.\n\t ]*
      because it didn't seem to like whitespace, but that didn't work
      either. Then I went character by character (all in the name of
      efficiency :) backwards from the closing tag. All of a sudden it
      started working when the content was ~900 chars or less? Is there a
      max limit on regexp hits? Am I doing something wrong? Thanks,
    • DZ-Jay
      ... try changing the .* to (.| n)* The problem is that in EditPlus the . does not match a new line. I just tested the following regexp:
      Message 2 of 2 , Feb 28 4:29 PM
      • 0 Attachment
        Some time around 02/28/2002, I think I heard you say:
        ><\!\-\- #BeginLibraryItem "blah_library\.lbi" \-\->.*<\!\-\-
        >#EndLibraryItem \-\->
        >
        >Each half, before and after the .*, works fine for hitting the tags
        >themselves. But the .* chokes. I tried replacing it with [.\n\t ]*
        >because it didn't seem to like whitespace, but that didn't work
        >either. Then I went character by character (all in the name of
        >efficiency :) backwards from the closing tag. All of a sudden it
        >started working when the content was ~900 chars or less? Is there a
        >max limit on regexp hits? Am I doing something wrong? Thanks,

        try changing the .* to (.|\n)*

        The problem is that in EditPlus the . does not match a new line.

        I just tested the following regexp:
        <\!\-\- #BeginLibraryItem "blah_library\.lbi" \-\->(.|\n)*<\!\-\-
        #EndLibraryItem \-\->

        and it matched the following strings:
        (notice: this is all supposed to be one line)
        <!-- #BeginLibraryItem "blah_library.lbi" -->something in here<!--
        #EndLibraryItem -->

        (notice: This spans multiple lines)
        <!-- #BeginLibraryItem "blah_library.lbi" -->
        something in here
        <!-- #EndLibraryItem -->

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