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

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

Expand Messages
  • Sheri
    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
    • Show all 9 messages in this topic