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

Re: Help with RegExp

Expand Messages
  • Sheri
    I still recommend going through these slides, very helpful for getting a handle on regular expressions (approx 16 mb):
    Message 1 of 12 , Jan 3, 2007
    • 0 Attachment
      I still recommend going through these slides, very helpful for getting
      a handle on regular expressions (approx 16 mb):

      <http://www.gravitonic.com/downloads/talks/phptek-2006/regex-clinic_phptek2006.pdf>

      Here's a tinyurl for it in case Yahoo breaks the link:

      http://tinyurl.com/yn6ejl

      Hope it helps,
      Sheri
    • Lee Underwood
      Thanks but it creates a Regex error: nothing to repeat . Then gives a clip error. It doesn t do anything. Lee On 1/3/2007 10:11 PM, buralex@gmail.com wrote:
      Message 2 of 12 , Jan 4, 2007
      • 0 Attachment
        Thanks but it creates a "Regex error: nothing to repeat". Then gives
        a clip error. It doesn't do anything.

        Lee


        On 1/3/2007 10:11 PM, buralex@... wrote:
        ........................................................
        >^!replace "*<strong>Details:</strong>*.*\*(.*)" >> "*<strong>Date
        >*$1:*</strong>*" rwasi
        >
        >the above is for Notetab 5 and relies on the existence of the * (escaped
        >with a backslash in the above) and keeps everything after the * to
        >end-of-line.
        >(not tested)
        >
        >Regards ... Alec -- buralex-gmail
        >--
        ........................................................
      • Lee Underwood
        Sheri, Thanks. I appreciate it. It looks like a good resource. I m not giving up learning this. I want to learn it inside and out. I am just trying right now
        Message 3 of 12 , Jan 4, 2007
        • 0 Attachment
          Sheri,

          Thanks. I appreciate it. It looks like a good resource.

          I'm not giving up learning this. I want to learn it inside and out. I
          am just trying right now to find a solution for an immediate problem.

          Lee


          On 1/3/2007 11:39 PM, Sheri wrote:
          ........................................................

          >I still recommend going through these slides, very helpful for
          >getting a handle on regular expressions (approx 16 mb):
          >
          ><http://www.gravitonic.com/downloads/talks/phptek-2006/regex-clinic_phptek2006.pdf>
          >
          >Here's a tinyurl for it in case Yahoo breaks the link:
          >
          >http://tinyurl.com/yn6ejl
          >
          >Hope it helps,
          >Sheri
          ........................................................
        • buralex@gmail.com
          Lee: This time I tested by putting the find clause and the replace clause in the REPLACE dialog, copied your original email to a new file in Notetab. Clicking
          Message 4 of 12 , Jan 4, 2007
          • 0 Attachment
            Lee: This time I tested by putting the find clause and the replace
            clause in the REPLACE dialog, copied your original email to a new file
            in Notetab.
            Clicking Find and then Replace (also tried again with immediately
            clicking Replace All)

            worked both times

            also made a one-line clip out of it - worked

            Did the line I sent originally get wrapped into two lines by Yahoo? Its
            supposed to be one line.

            When I get inexplicable errors like this (happens frequently :-[ ) I
            usually try to break it down by testing in the Replace dialog, first
            putting in a sub-set of what I'm trying to do and then adding one clause
            at a time until I figure out what the "stupid" mistake is that I'm
            overlooking!

            If/when you figure it out please post back ....

            I just noticed that the replace clause as you show it in your quote it
            is totally mangled! the stuff after the >> and inside quotes is supposed
            to be exactly:
            =====>"<strong>Date $1:</strong>"<========
            In your quote of what I sent I see:
            =====>"*<strong>Date
            >*$1:*</strong>*"<========

            broken over two lines and with asterisks(stars) where they have no
            business being!


            > Thanks but it creates a "Regex error: nothing to repeat". Then gives
            > a clip error. It doesn't do anything.
            >
            > Lee
            >
            >
            > On 1/3/2007 10:11 PM, buralex@... wrote:
            > ........................................................
            >
            >> >^!replace "*<strong>Details:</strong>*.*\*(.*)" >> "*<strong>Date
            >> >*$1:*</strong>*" rwasi
            >> >
            >> >the above is for Notetab 5 and relies on the existence of the * (escaped
            >> >with a backslash in the above) and keeps everything after the * to
            >> >end-of-line.
            >> >(not tested)

            Regards ... Alec -- buralex-gmail
            --



            [Non-text portions of this message have been removed]
          • Sheri
            Hi Alec, When NoteTab gives a regex error, it is only ever referring to the search side of a replace command. You have some unescaped asterisks there,
            Message 5 of 12 , Jan 4, 2007
            • 0 Attachment
              Hi Alec,

              When NoteTab gives a regex error, it is only ever referring to the
              search side of a replace command.

              You have some unescaped asterisks there, especially the first
              character. I haven't tested it, but it looks like a problem to me:

              > "*<strong>Details:</strong>*.*\*(.*)"

              Regards,
              Sheri
            • Alec Burgess
              Sheri,Lee: It looks like Thunderbird was munging what I sent (I think recognizing the strong tag in angle brackets and trying to help by putting the
              Message 6 of 12 , Jan 4, 2007
              • 0 Attachment
                Sheri,Lee: It looks like Thunderbird was munging what I sent (I think
                recognizing the strong tag in angle brackets and trying to "help" by
                putting the asterisks around them (the normal way to signal emphasis
                when sending text email) (underlines similarly are used to mark
                underlines and slashes to mark italics)

                In any case, I'm sending this from the yahoo-groups web interface in
                Firefox 2. Sorry for all the confusion Lee. Here's what I intended to
                send originally (hope it comes through OK):

                ======= (one line)
                ^!replace "<strong>Details:</strong>.*\*(.*)" >> "<strong>Date
                $1:</strong>" rwasi
                ======= (end one line)
                There are only three asterisks in the above, a dot-star, a back-slash
                star and another dot_star in parentheses!

                --- In ntb-clips@yahoogroups.com, "Sheri" <silvermoonwoman@...> wrote:
                >
                > Hi Alec,
                >
                > When NoteTab gives a regex error, it is only ever referring to the
                > search side of a replace command.
                >
                > You have some unescaped asterisks there, especially the first
                > character. I haven't tested it, but it looks like a problem to me:
                >
                > > "*<strong>Details:</strong>*.*\*(.*)"
                >
                > Regards,
                > Sheri
                >
              • junja
                Sending code to people who use Thunderbird for their email can be tricky, in particular over characters. Tb users should check the syntax of any code they
                Message 7 of 12 , Jan 7, 2007
                • 0 Attachment
                  Sending code to people who use Thunderbird for their email
                  can be tricky, in particular over '>' characters. Tb users
                  should check the syntax of any code they copy and paste
                  which contains '>' characters against the original email.
                  junja


                  Alec Burgess wrote:
                  > Sheri,Lee: It looks like Thunderbird was munging what I sent (I think
                  > recognizing the strong tag in angle brackets and trying to "help" by
                  > putting the asterisks around them (the normal way to signal emphasis
                  > when sending text email) (underlines similarly are used to mark
                  > underlines and slashes to mark italics)
                  >
                  > In any case, I'm sending this from the yahoo-groups web interface in
                  > Firefox 2. Sorry for all the confusion Lee. Here's what I intended to
                  > send originally (hope it comes through OK):
                  >
                  > ======= (one line)
                  > ^!replace "<strong>Details:</strong>.*\*(.*)" >> "<strong>Date
                  > $1:</strong>" rwasi
                  > ======= (end one line)
                  > There are only three asterisks in the above, a dot-star, a back-slash
                  > star and another dot_star in parentheses!
                  >
                  > --- In ntb-clips@yahoogroups.com, "Sheri" <silvermoonwoman@...> wrote:
                  >> Hi Alec,
                  >>
                  >> When NoteTab gives a regex error, it is only ever referring to the
                  >> search side of a replace command.
                  >>
                  >> You have some unescaped asterisks there, especially the first
                  >> character. I haven't tested it, but it looks like a problem to me:
                  >>
                  >>> "*<strong>Details:</strong>*.*\*(.*)"
                  >> Regards,
                  >> Sheri
                  >>
                  >
                  >
                  >
                  >
                  > Fookes Software: http://www.fookes.us, http://www.fookes.com
                  > Fookes Software Mailing Lists: http://www.fookes.us/maillist.htm
                  >
                  > Yahoo! Groups Links
                  >
                  >
                  >
                  >
                • Lee Underwood
                  Alec, This works except it includes the entire rest of the portion (making it all bold). Here is a sample of what I have to change (portions to be changed are
                  Message 8 of 12 , Jan 8, 2007
                  • 0 Attachment
                    Alec,

                    This works except it includes the entire rest of the portion (making
                    it all bold). Here is a sample of what I have to change (portions to
                    be changed are in red):

                    <strong>Title:</strong> <a name="Credit_Card_Number_Validation"
                    href="http://javascript.internet.com/forms/credit-card-number-validation.html">Credit
                    Card Number Validation</a><br><strong>Contributor:</strong> David
                    Leppek</a> <br><strong>Contributor URL:</strong> <a
                    href="https://www.azcode.com/Mod10">https://www.azcode.com/Mod10</a><br><strong>Details:</strong>
                    4.97 KB * Uploaded November 7
                    2005<br><strong>Description:</strong> Determine if a credit card
                    number could be valid before submitting it for real-time online
                    authentication. Based on ANSI X4.13, the LUHN formula, aka the Mod 10
                    algorithm is used to validate accurate credit card numbers. Heavily
                    commented.</p><p class="listingalign" align="right">[ <a
                    href="http://javascript.internet.com/forms/credit-card-number-validation.html#source">Get
                    Source Code</a> ]
                    <hr noshade size="2">


                    Here is what I want to change it to:


                    <strong>Title:</strong> <a name="Credit_Card_Number_Validation"
                    href="http://javascript.internet.com/forms/credit-card-number-validation.html">Credit
                    Card Number Validation</a><br><strong>Contributor:</strong> David
                    Leppek</a> <br><strong>Contributor URL:</strong> <a
                    href="https://www.azcode.com/Mod10">https://www.azcode.com/Mod10</a><br><strong>Date
                    Uploaded:</strong> November 7 2005<br><strong>Description:</strong>
                    Determine if a credit card number could be valid before submitting it
                    for real-time online authentication. Based on ANSI X4.13, the LUHN
                    formula, aka the Mod 10 algorithm is used to validate accurate credit
                    card numbers. Heavily commented.</p>
                    <hr noshade size="2">



                    I hope that a bit more clearer. I tried changing yours but I haven't
                    a clue. Once I get this done I'm jumping in full-speed into RegEx.
                    It's kind of like when I was a kid and learning math, it took a bit
                    and then, bam! I got it!

                    Thanks for your help.

                    Lee



                    On 1/4/2007 08:49 PM, Alec Burgess wrote:
                    ........................................................

                    >Sheri,Lee: It looks like Thunderbird was munging what I sent (I think
                    >recognizing the strong tag in angle brackets and trying to "help" by
                    >putting the asterisks around them (the normal way to signal emphasis
                    >when sending text email) (underlines similarly are used to mark
                    >underlines and slashes to mark italics)
                    >
                    >In any case, I'm sending this from the yahoo-groups web interface in
                    >Firefox 2. Sorry for all the confusion Lee. Here's what I intended to
                    >send originally (hope it comes through OK):
                    >
                    >======= (one line)
                    >^!replace "<strong>Details:</strong>.*\*(.*)" >> "<strong>Date
                    >$1:</strong>" rwasi
                    >======= (end one line)
                    >There are only three asterisks in the above, a dot-star, a back-slash
                    >star and another dot_star in parentheses!
                    >
                    ........................................................

                    [Non-text portions of this message have been removed]
                  • Sheri
                    Try it this way: ^!Replace (?s)( .*?)Details:.*?( ).+?(Uploaded) $1Date $3$2 RAWS0 can also be written so it defaults to Ungreedy to
                    Message 9 of 12 , Jan 8, 2007
                    • 0 Attachment
                      Try it this way:

                      ^!Replace "(?s)(<strong>.*?)Details:.*?(</strong>).+?(Uploaded)" >>
                      "$1Date $3$2" RAWS0

                      can also be written so it defaults to Ungreedy to avoid needing the
                      question marks:

                      ^!Replace "(?sU)(<strong>.*)Details:.*(</strong>).+(Uploaded)" >>
                      "$1Date $3$2" RAWS0

                      Regards,
                      Sheri
                    • Lee Underwood
                      Sheri, Thanks! That works great! I was also able to adapt it for another change. I ll take a dissect it to get a better understanding. Thanks again. Lee On
                      Message 10 of 12 , Jan 9, 2007
                      • 0 Attachment
                        Sheri,

                        Thanks! That works great! I was also able to adapt it for another
                        change. I'll take a dissect it to get a better understanding.

                        Thanks again.

                        Lee




                        On 1/8/2007 06:55 PM, Sheri wrote:
                        ........................................................

                        >Try it this way:
                        >
                        >^!Replace "(?s)(<strong>.*?)Details:.*?(</strong>).+?(Uploaded)" >>
                        >"$1Date $3$2" RAWS0
                        >
                        >can also be written so it defaults to Ungreedy to avoid needing the
                        >question marks:
                        >
                        >^!Replace "(?sU)(<strong>.*)Details:.*(</strong>).+(Uploaded)" >>
                        >"$1Date $3$2" RAWS0
                        >
                        >Regards,
                        >Sheri
                        ........................................................
                      Your message has been successfully submitted and would be delivered to recipients shortly.