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

Re: [Clip] Re: Quick RegEx Question

Expand Messages
  • Don - HtmlFixIt.com
    for example ...
    Message 1 of 6 , Aug 23, 2009
    • 0 Attachment
      for example ...

      > Use (?s) in a pattern prior to where you want dot to start matching all characters, including CR and LF. You can turn that behavior off later in the same pattern (if desired) with (?-s).
      >
      > Regards,
      > Sheri
    • John Shotsky
      Here is one way. There are probably more efficient ways. If there are multiple Cr s possible, you may need a loop or a better expression. ^!Replace
      Message 2 of 6 , Aug 24, 2009
      • 0 Attachment
        Here is one way. There are probably more efficient ways. If there are multiple Cr's possible, you may need a loop or a
        better expression.
        ^!Replace "<textarea(.*\R?.*)textarea>" >> "" ARTSW

        John

        From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Art Kocsis
        Sent: Monday, August 24, 2009 12:26
        To: NoteTab-Clips
        Subject: [Clip] Quick RegEx Question


        Hello,

        How do I specify this expression to include embedded CRLFs?
        The default behavior for the period is to NOT include CRLF.
        Can I change the default?

        ^!Replace "<textarea(.*)textarea>" >> "" ARSW

        Thanks for the help

        Namaste', Art

        ----------

        No virus found in this outgoing message.
        Checked by AVG - www.avg.com
        Version: 8.5.409 / Virus Database: 270.13.65/2324 - Release Date: 08/24/09 12:55:00

        [Non-text portions of this message have been removed]



        [Non-text portions of this message have been removed]
      • silvermoonwoman2001
        ... Use (?s) in a pattern prior to where you want dot to start matching all characters, including CR and LF. You can turn that behavior off later in the same
        Message 3 of 6 , Aug 24, 2009
        • 0 Attachment
          --- In ntb-clips@yahoogroups.com, Art Kocsis <artkns@...> wrote:
          >
          > Hello,
          >
          > How do I specify this expression to include embedded CRLFs?
          > The default behavior for the period is to NOT include CRLF.
          > Can I change the default?
          >
          > ^!Replace "<textarea(.*)textarea>" >> "" ARSW
          >
          > Thanks for the help
          >
          > Namaste', Art
          >

          Use (?s) in a pattern prior to where you want dot to start matching all characters, including CR and LF. You can turn that behavior off later in the same pattern (if desired) with (?-s).

          Regards,
          Sheri
        • Axel Berger
          ... ^!Replace (?s) ARSW Note: I have omitted the superfluous brackets inside, as you don t want to catch anything for further use.
          Message 4 of 6 , Aug 24, 2009
          • 0 Attachment
            "Don - HtmlFixIt.com" wrote:
            > for example ...

            ^!Replace "(?s)<textarea.*?textarea>" >> "" ARSW

            Note: I have omitted the superfluous brackets inside, as you don't want
            to catch anything for further use. Instead I have added tie importent
            modifier "?" meaning "as little as possible". The default is "as much as
            possible". Example:

            <textarea>nonsense</textarea> important stuff <textarea>more
            nonsense</textarea>

            Without the "?" the expression will match everthing between the very
            first and the very last textarea including all the important stuff in
            between. With "?" it stops as soon as it can while fulfilling the
            condition, deleting just the nonsense and leaving the important stuff
            alone.

            Axel
          • Art Kocsis
            Hello, Thanks for the help. I thought there should be a simple fix and you guys proved it. I especially want to thank Shari & Axel for including explanations
            Message 5 of 6 , Aug 24, 2009
            • 0 Attachment
              Hello,

              Thanks for the help. I thought there should be a simple fix and you guys
              proved it.
              I especially want to thank Shari & Axel for including explanations and Axel
              for
              reminding me about greedy expressions. That would have driven me up the wall
              as the files are full of multiple instances with lots of "important stuff"
              between
              instances! And it sure works a lot better when I inserted the 2nd "?" and
              put it
              outside of the parenthesis! <g>

              I don't use RegEx very often (probably because I don't know it well), so I
              do not
              remember the syntax or operators between uses. NoteTab's built in RegEx help
              file is pretty useless to me and only leads to frustration. Even armed with
              the
              knowledge of (?s), NTB's help file didn't. There was only an entry for
              dotall with
              no explanation of usage or how to turn it off.

              What do you recommend for a resource, either online or downloadable, both to
              look up stuff like this as well as to learn the "language"?

              Thanks again for the assistance.

              Namaste', Art

              BTW Don, either you are psychic with slow email and responded a day before I
              asked or your system clock is a day off. <g> Pick up an atomic clock updater
              from NIST [http://tf.nist.gov/service/its.htm%5d and forget about ever having
              to set
              your clock again.


              At 08-24-2009 12:50, Sheri wrote:
              >--- In <mailto:ntb-clips%40yahoogroups.com>ntb-clips@yahoogroups.com, Art
              >Kocsis <artkns@...> wrote:
              > > How do I specify this expression to include embedded CRLFs?
              > > The default behavior for the period is to NOT include CRLF.
              > > Can I change the default?
              > >
              > > ^!Replace "<textarea(.*)textarea>" >> "" ARSW
              > >
              > > Thanks for the help
              >
              >Use (?s) in a pattern prior to where you want dot to start matching all
              >characters, including CR and LF. You can turn that behavior off later in
              >the same pattern (if desired) with (?-s).
              >
              >Regards,
              >Sheri

              At 08-24-2009 16:04, Axel wrote:
              >"Don - HtmlFixIt.com" wrote:
              > > for example ...
              >
              >^!Replace "(?s)<textarea.*?textarea>" >> "" ARSW
              >
              >Note: I have omitted the superfluous brackets inside, as you don't want
              >to catch anything for further use. Instead I have added tie importent
              >modifier "?" meaning "as little as possible". The default is "as much as
              >possible". Example:
              >
              ><textarea>nonsense</textarea> important stuff <textarea>more
              >nonsense</textarea>
              >
              >Without the "?" the expression will match everthing between the very
              >first and the very last textarea including all the important stuff in
              >between. With "?" it stops as soon as it can while fulfilling the
              >condition, deleting just the nonsense and leaving the important stuff
              >alone.
              >
              >Axel

              ----------


              No virus found in this outgoing message.
              Checked by AVG - www.avg.com
              Version: 8.5.409 / Virus Database: 270.13.65/2324 - Release Date: 08/24/09 12:55:00


              [Non-text portions of this message have been removed]
            Your message has been successfully submitted and would be delivered to recipients shortly.