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

23866RE: [Clip] Help with variables

Expand Messages
  • John Shotsky
    Jun 10, 2013
      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.

      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 09:26
      To: ntb-clips@yahoogroups.com
      Subject: Re: [Clip] Help with variables

      Not sure what you are trying to do John, but regex is your friend.
      ^!Set %animal%="(cat|rat|dog)(s?)"
      ;uncomment find or replace
      ;^!Find "^%animal%" CIRS
      ^!Replace "^%animal%" >> "*$1$2*" RAWH

      On 6/10/2013 11:10 AM, John Shotsky wrote:
      > I would like some ideas for how to handle the following issue efficiently.
      > I set a variable called %animal%
      > In that variable, I store cat|dog|rat, all without parens or plurals.
      > I would like to keep that variable, because there are times it needs to work only on singular animals, but I want another variable
      > that includes the singular word with ['s?] added to it, so it will capture both the singular and plural words.
      > So, one variable would be cat|dog|rat
      > And the second would be made from the first one by adding [s?] to each term.
      > cats?|dogs?|rats?
      > I have tried various ways to implement this and haven't found a satisfactory way. The reason I need this is so that the plural
      > is always captured if present as when ^%animals% is used. I know I need to substitute [%s|] for each vertical bar, but it needs
      > on the last term too. Any ideas for how to form this variable correctly? (I guess I could form a fake term, like zzzzz for the
      > one, but I'd still like to know how to do it right.)
      > Here's a test phrase:
      > The cats play with the dogs. The rat chases the cat. The dog chases the rats.
      > ^%animal% should find only singular as in (^%animal%)\b
      > But (^%animals%) should capture both singular and plural and never miss an 's' if present.
      > Thanks,
      > John Shotsky
      > [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

      [Non-text portions of this message have been removed]
    • Show all 12 messages in this topic