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

23870Re: [Clip] Help with variables

Expand Messages
  • Don
    Jun 10, 2013
    • 0 Attachment
      Like I said at the outset, I don't get what you want to do exactly and
      it doesn't become clearer to me with repeat of the same.

      I don't think you mean that you want to add s? to the end of each, but
      maybe you do since that is what you said.

      ^!Set %animal%="cat|rat|dog"
      ^!Set %animals%=^$StrReplace("|";"s?|";"^%animal%";False;False)$s?

      Seems to do what you claim you want to do. I am happy to help of
      course, but solving a problem that *I* don't find clearly stated ...
      we'll then I'm guessing at answers.


      On 6/10/2013 2:54 PM, John Shotsky wrote:
      > Thanks for the ideas but…
      >
      > I want to create a variable from another variable that has the same ending on each entity in the new variable. I know how to do it
      > outside the variable, and that's exactly what I don't want to do. I want two variables that I can call upon for whatever need I
      > happen to have. I only want one list of the entities, so I don't have to try to keep two of them in sync. The two variables have the
      > same content except that the plural one has s? at the end of each entity inside the variable. I need the code to create the new
      > variable, not a different solution to the problem. In fact, I have been doing it the external way for a long time - but it becomes
      > cumbersome at times, and having a single variable to suit a given purpose works far more efficiently.
      >
      > Regards,
      > John
      > RecipeTools Web Site: <http://recipetools.gotdns.com/> http://recipetools.gotdns.com/
      > John's Mags Yahoo Group: <http://groups.yahoo.com/group/johnsmags/> http://groups.yahoo.com/group/johnsmags/
      >
      > From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Don
      > Sent: Monday, June 10, 2013 11:32
      > To: ntb-clips@yahoogroups.com
      > Subject: Re: [Clip] Help with variables
      >
      >
      > Still not sure I follow ... but okay, just ask for what you want to match:
      > ^!Set %animal%="(cat|rat|dog)"
      > :start_loop
      > ^!Set %singular%=^?{(T=L,H=5) Singular==_Singular Only^=1|Plural
      > Only^=2|Both^=3}
      > ^!If "^%singular%" = "1" single
      > ^!If "^%singular%" = "2" plural
      > ^!If "^%singular%" = "3" both
      > ^!Goto start_loop
      >
      > :single
      > ^!Replace "(^%animal%\b)" >> "*$1*" RWAIS
      > ^!Goto start_loop
      >
      > :plural
      > ^!Replace "(^%animal%s\b)" >> "*$1*" RWAIS
      > ^!Goto start_loop
      >
      > :both
      > ^!Replace "(^%animal%s?\b)" >> "*$1*" RWAIS
      > ^!Goto start_loop
      >
      > On 6/10/2013 12:45 PM, John Shotsky wrote:
      >> I need a way to find ONLY the singular version in one case, and I need to find any version in the other case.
      >>
      >> So, the task is to get the [s?] INTO each element of the second variable itself, not outside it. I realize I can also place parens
      >> around the whole thing and treat it as one item, but that gets confusing when you have lots of numbered captures to sort out.
      > Simply
      >> put, I want to use (^%animal%)\b when I'm looking for the singular version, and (^%animals%)\b when I don't care which it is. But
      > I
      >> only want to have to enter all the animal names once, for the singular version of the variable. I just don't know how to do the
      >> replaces inside the variable. That's why I asked.
      >>
      >> Regards,
      >> John
      >> RecipeTools Web Site: <http://recipetools.gotdns.com/> http://recipetools.gotdns.com/
      >> John's Mags Yahoo Group: <http://groups.yahoo.com/group/johnsmags/> http://groups.yahoo.com/group/johnsmags/
      >
      >
      >
      > [Non-text portions of this message have been removed]
      >
      >
      >
      > ------------------------------------
      >
      > Fookes Software: http://www.fookes.com/
      > NoteTab website: http://www.notetab.com/
      > NoteTab Discussion Lists: http://www.notetab.com/groups.php
      >
      > ***
      > Yahoo! Groups Links
      >
      >
      >
      >
    • Show all 12 messages in this topic