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

Re: [Clip] best way to substitute a list of items

Expand Messages
  • Sheri
    ... Such as you ve shown it, you re replacing in an empty string ^%current_event% ... Is this one event or 5? ... Where did %gender% get set? I think you
    Message 1 of 9 , May 1, 2009
    • 0 Attachment
      --- In ntb-clips@yahoogroups.com, "Don - HtmlFixIt.com" <don@...> wrote:
      >
      > ;assign event codes for hytek
      > ^!Set %current_event%=^$StrReplace(" Relay";"R";"^%current_event%";Yes;Yes)$
      > ^!Set %current_event%=^$StrReplace(" Run";"";"^%current_event%";Yes;Yes)$
      > ^!Set %current_event%=^$StrReplace(" Dash";"";"^%current_event%";Yes;Yes)$
      > ^!Set %current_event%=^$StrReplace(" LH";"H";"^%current_event%";Yes;Yes)$
      > ^!If "^%gender%" = "M" Next ELSE Skip
      > ^!Set %current_event%=^$StrReplace("100/110
      > HH";"110H";"^%current_event%";Yes;Yes)$
      > ^!Set %current_event%=^$StrReplace("100/110
      > HH";"100H";"^%current_event%";Yes;Yes)$
      >

      Such as you've shown it, you're replacing in an empty string ^%current_event%

      > better ideas?
      >
      > Don - HtmlFixIt.com wrote:
      > > I have a list of items that are track events:
      > > 3200 Relay
      > > 300 Hurdles
      > > 400 Run
      > > 100 Run
      > > 100/110 HH

      Is this one event or 5?

      > >
      > > When I actually use them I want them to read thus:
      > > 3200R
      > > 300H
      > > 400
      > > 100
      > > (this one is tricky)
      > > if ^%gender%=M then 110H
      > > but if ^%gender%=F then 100H

      Where did %gender% get set?

      I think you probably want to want to find a series of lines that represents a "gender event" and then do a series of replace-in-highlight on it. Then loop to do the next "gender event".

      Regards,
      Sheri
    • Don - HtmlFixIt.com
      well current_event has in it one of the terms I described at the outset by the time we arrive here in the clip that runs for several hundred lines ... so I
      Message 2 of 9 , May 1, 2009
      • 0 Attachment
        well current_event has in it one of the terms I described at the outset
        by the time we arrive here in the clip that runs for several hundred
        lines ... so I just need to modify the term at this point in the clip
        ... this is working fine, but just seems cumbersome.

        There are actually 17 events, but I only picked five that are
        representative -- any one of the five may currently occupy that variable.

        My data is in a grid where there are ten rows of entrants below five
        events, and then ten more rows of five events and repeat again ... so it
        is really a three dimensional array of sorts that I am actually working
        on. But I cannot simply search and replace as their are other data
        elements in the form that I cannot act on.

        So I have already retrieved an event name when I am using this series of
        lines.

        Sheri wrote:
        > --- In ntb-clips@yahoogroups.com, "Don - HtmlFixIt.com" <don@...> wrote:
        >> ;assign event codes for hytek
        >> ^!Set %current_event%=^$StrReplace(" Relay";"R";"^%current_event%";Yes;Yes)$
        >> ^!Set %current_event%=^$StrReplace(" Run";"";"^%current_event%";Yes;Yes)$
        >> ^!Set %current_event%=^$StrReplace(" Dash";"";"^%current_event%";Yes;Yes)$
        >> ^!Set %current_event%=^$StrReplace(" LH";"H";"^%current_event%";Yes;Yes)$
        >> ^!If "^%gender%" = "M" Next ELSE Skip
        >> ^!Set %current_event%=^$StrReplace("100/110
        >> HH";"110H";"^%current_event%";Yes;Yes)$
        >> ^!Set %current_event%=^$StrReplace("100/110
        >> HH";"100H";"^%current_event%";Yes;Yes)$
        >>
        >
        > Such as you've shown it, you're replacing in an empty string ^%current_event%
        >
        >> better ideas?
        >>
        >> Don - HtmlFixIt.com wrote:
        >>> I have a list of items that are track events:
        >>> 3200 Relay
        >>> 300 Hurdles
        >>> 400 Run
        >>> 100 Run
        >>> 100/110 HH
        >
        > Is this one event or 5?
        >
        >>> When I actually use them I want them to read thus:
        >>> 3200R
        >>> 300H
        >>> 400
        >>> 100
        >>> (this one is tricky)
        >>> if ^%gender%=M then 110H
        >>> but if ^%gender%=F then 100H
        >
        > Where did %gender% get set?
        >
        > I think you probably want to want to find a series of lines that represents a "gender event" and then do a series of replace-in-highlight on it. Then loop to do the next "gender event".
        >
        > Regards,
        > Sheri
        >
        >
        >
        > ------------------------------------
        >
        > Fookes Software: http://www.fookes.com/
        > NoteTab website: http://www.notetab.com/
        > NoteTab Discussion Lists: http://www.notetab.com/groups.php
        >
        > ***
        > Yahoo! Groups Links
        >
        >
        >
        >
      • Sheri
        ... I suppose you could paste the ^%current_event% to a new document to avoid doing several strreplaces on it. But the best you will save is one command, that
        Message 3 of 9 , May 1, 2009
        • 0 Attachment
          Don - HtmlFixIt.com wrote:
          > well current_event has in it one of the terms I described at the outset
          > by the time we arrive here in the clip that runs for several hundred
          > lines ... so I just need to modify the term at this point in the clip
          > ... this is working fine, but just seems cumbersome.
          >
          I suppose you could paste the ^%current_event% to a new document to
          avoid doing several strreplaces on it. But the best you will save is one
          command, that replaces " Run| Dash" with "".
          > There are actually 17 events, but I only picked five that are
          > representative -- any one of the five may currently occupy that variable.
          >
          > My data is in a grid where there are ten rows of entrants below five
          > events, and then ten more rows of five events and repeat again ... so it
          > is really a three dimensional array of sorts that I am actually working
          > on. But I cannot simply search and replace as their are other data
          > elements in the form that I cannot act on.
          >
          > So I have already retrieved an event name when I am using this series of
          > lines.
          >
          > Sheri wrote:
          >
          >> --- In ntb-clips@yahoogroups.com, "Don - HtmlFixIt.com" <don@...> wrote:
          >>
          >>> ;assign event codes for hytek
          >>> ^!Set %current_event%=^$StrReplace(" Relay";"R";"^%current_event%";Yes;Yes)$
          >>> ^!Set %current_event%=^$StrReplace(" Run";"";"^%current_event%";Yes;Yes)$
          >>> ^!Set %current_event%=^$StrReplace(" Dash";"";"^%current_event%";Yes;Yes)$
          >>> ^!Set %current_event%=^$StrReplace(" LH";"H";"^%current_event%";Yes;Yes)$
          >>> ^!If "^%gender%" = "M" Next ELSE Skip
          >>> ^!Set %current_event%=^$StrReplace("100/110
          >>> HH";"110H";"^%current_event%";Yes;Yes)$
          >>> ^!Set %current_event%=^$StrReplace("100/110
          >>> HH";"100H";"^%current_event%";Yes;Yes)$
          >>>
          >>>
          >> Such as you've shown it, you're replacing in an empty string ^%current_event%
          >>
          >>
          >>> better ideas?
          >>>
          >>> Don - HtmlFixIt.com wrote:
          >>>
          >>>> I have a list of items that are track events:
          >>>> 3200 Relay
          >>>> 300 Hurdles
          >>>> 400 Run
          >>>> 100 Run
          >>>> 100/110 HH
          >>>>
          >> Is this one event or 5?
          >>
          >>
          >>>> When I actually use them I want them to read thus:
          >>>> 3200R
          >>>> 300H
          >>>> 400
          >>>> 100
          >>>> (this one is tricky)
          >>>> if ^%gender%=M then 110H
          >>>> but if ^%gender%=F then 100H
          >>>>
          >> Where did %gender% get set?
          >>
          >> I think you probably want to want to find a series of lines that represents a "gender event" and then do a series of replace-in-highlight on it. Then loop to do the next "gender event".
          >>
          >> Regards,
          >> Sheri
          >>
          >>
          >>
          >> ------------------------------------
          >>
          >> Fookes Software: http://www.fookes.com/
          >> NoteTab website: http://www.notetab.com/
          >> NoteTab Discussion Lists: http://www.notetab.com/groups.php
          >>
          >> ***
          >> Yahoo! Groups Links
          >>
          >>
          >>
          >>
          >>
          >
          >
          > ------------------------------------
          >
          > Fookes Software: http://www.fookes.com/
          > NoteTab website: http://www.notetab.com/
          > NoteTab Discussion Lists: http://www.notetab.com/groups.php
          >
          > ***
          > Yahoo! Groups Links
          >
          >
          >
          >
          >
        • Sheri
          Sorry I pressed Send before I was finished. ^!Replace (?J)( (? R)elay| (? H)urdles| (? )Run| (? )Dash) $ RAWS0 Starting Document text: 3200
          Message 4 of 9 , May 1, 2009
          • 0 Attachment
            Sorry I pressed Send before I was finished.

            ^!Replace "(?J)( (?<m>R)elay| (?<m>H)urdles| (?<m>)Run| (?<m>)Dash)" >>
            "$<m>" RAWS0

            Starting Document text:

            3200 Relay
            300 Hurdles
            400 Run
            100 Run
            100/110 HH

            After the replace is:

            3200R
            300H
            400
            100
            100/110 HH

            Regards,
            Sheri
          • Flo
            ... What about this... ^!Set %gender%=^?{Gender is...==_F|M} ^!Replace (?| x20(R)elay| x20(H)urdles| x20Run| x20Dash) $1 AWRS ^!If ^%gender%=M Next Else
            Message 5 of 9 , May 1, 2009
            • 0 Attachment
              --- In ntb-clips@yahoogroups.com, Sheri <silvermoonwoman@...> wrote:
              >
              > Sorry I pressed Send before I was finished.
              >
              > ^!Replace "(?J)( (?<m>R)elay| (?<m>H)urdles| (?<m>)Run| (?<m>)Dash)" >>
              > "$<m>" RAWS0
              >
              > Starting Document text:
              >
              > 3200 Relay
              > 300 Hurdles
              > 400 Run
              > 100 Run
              > 100/110 HH
              >
              > After the replace is:
              >
              > 3200R
              > 300H
              > 400
              > 100
              > 100/110 HH
              >
              > Regards,
              > Sheri


              What about this...

              ^!Set %gender%=^?{Gender is...==_F|M}
              ^!Replace "(?|\x20(R)elay|\x20(H)urdles|\x20Run|\x20Dash)" >> "$1" AWRS
              ^!If ^%gender%=M Next Else Skip_2
              ^!Replace "^\d+/(\d+)\x20HH$" >> "$1H" AWRS
              ^!Goto End
              ^!Replace "^(\d+)/\d+\x20HH$" >> "$1H" AWRS

              Sheri uses (?J) which allows duplicate subpattern names. Just for a change, I tried (?| which allows duplicate subpattern numbers. I hope it will survive Sheri's critical eye ;-)

              I also tried to solve the "gender problem" that Don described in his first message.

              Flo
            • Sheri
              ... Thanks Flo, you taught me some things :) For one, I thought it was necessary to capture the empty string or the token in the replacement string would be
              Message 6 of 9 , May 1, 2009
              • 0 Attachment
                --- In ntb-clips@yahoogroups.com, "Flo" <flo.gehrke@...> wrote:
                >
                > --- In ntb-clips@yahoogroups.com, Sheri <silvermoonwoman@> wrote:
                > >
                > > Sorry I pressed Send before I was finished.
                > >
                > > ^!Replace "(?J)( (?<m>R)elay| (?<m>H)urdles| (?<m>)Run| (?<m>)Dash)" >>
                > > "$<m>" RAWS0
                > >
                > > Starting Document text:
                > >
                > > 3200 Relay
                > > 300 Hurdles
                > > 400 Run
                > > 100 Run
                > > 100/110 HH
                > >
                > > After the replace is:
                > >
                > > 3200R
                > > 300H
                > > 400
                > > 100
                > > 100/110 HH
                > >
                > > Regards,
                > > Sheri
                >
                >
                > What about this...
                >
                > ^!Set %gender%=^?{Gender is...==_F|M}
                > ^!Replace "(?|\x20(R)elay|\x20(H)urdles|\x20Run|\x20Dash)" >> "$1" AWRS
                > ^!If ^%gender%=M Next Else Skip_2
                > ^!Replace "^\d+/(\d+)\x20HH$" >> "$1H" AWRS
                > ^!Goto End
                > ^!Replace "^(\d+)/\d+\x20HH$" >> "$1H" AWRS
                >
                > Sheri uses (?J) which allows duplicate subpattern names. Just for a change, I tried (?| which allows duplicate subpattern numbers. I hope it will survive Sheri's critical eye ;-)
                >
                > I also tried to solve the "gender problem" that Don described in his first message.
                >
                > Flo
                >

                Thanks Flo, you taught me some things :)

                For one, I thought it was necessary to capture the empty string or the token in the replacement string would be not work properly. For another I didn't even know about ?|

                Regards,
                Sheri
              • Alec Burgess
                Sheri (silvermoonwoman@comcast.net) wrote (in part) (on 2009-05-01 at ... Flo and Sheri - you are both scary good :-) Current documentation for Notetab
                Message 7 of 9 , May 2, 2009
                • 0 Attachment
                  Sheri (silvermoonwoman@...) wrote (in part) (on 2009-05-01 at
                  23:40):
                  > Thanks Flo, you taught me some things :) For one, I thought it was
                  > necessary to capture the empty string or the token in the replacement
                  > string would be not work properly. For another I didn't even know
                  > about ?|

                  Flo and Sheri - you are both scary good :-)
                  Current documentation for Notetab regular expressions: Regex.chm (mine
                  is dated Friday, March 27, 2009, 05:08:00) includes:

                  (?| - DUPLICATE SUBPATTERN NUMBERS it says introduced with Perl 5.10)
                  but does not include any mention I could find of
                  (?N option - allow duplicate names

                  from the Regex.chm we have:
                  > INTERNAL OPTION SETTING
                  >
                  > The settings of the PCRE_CASELESS, PCRE_MULTILINE, PCRE_DOTALL, and
                  > PCRE_EXTENDED options (which are Perl-compatible) can be changed from
                  > within the pattern by a sequence of Perl option letters enclosed
                  > between "(?" and ")". The option letters are
                  >
                  > i for PCRE_CASELESS
                  > m for PCRE_MULTILINE
                  > s for PCRE_DOTALL
                  > x for PCRE_EXTENDED

                  In http://www.pcre.org/pcre.txt we have:
                  > OPTION SETTING
                  >
                  > (?i) caseless
                  > (?J) allow duplicate names
                  > (?m) multiline
                  > (?s) single line (dotall)
                  > (?U) default ungreedy (lazy)
                  > (?x) extended (ignore white space)
                  > (?-...) unset option(s)
                  I'm confused .... ?
                  Unfortunately neither (?| nor (?J appears to be supported in current
                  RegexBuddy - I think its still a couple of versions behind in its PCRE
                  support / (emulation?)

                  --
                  Regards ... Alec (buralex@gmail & WinLiveMess - alec.m.burgess@skype)




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