Grooper 21.00.0082 is available as of 12-12-2023! Check the  Downloads Discussion  for the release notes and to get the latest version.
Grooper 23.00.0042 is available as of 03-22-2024! Check the Downloads Discussion for the release notes and to get the latest version.
Grooper 23.1.0018 is available as of 04-15-2024! Check the  Downloads Discussion  for the release notes and to get the latest version.
Options

RegEx Positive Look Ahead

hjanumhjanum Posts: 110 ✭✭
I was trying to look for three words in random order. Normally this is done with a RegEx Positive Lookahead.

Example: (?=.*\bONE\b)(?=.*\bTWO\b)(?=.*\bTHREE\b)

I tried this in a Grooper extractor, but it did not return any results. Is there a trick to doing this?

Answers

  • Options
    jlunsfordjlunsford Posts: 138 mod
    Try using Grooper's built in look ahead tool and enter those three as regular regex
    Example: ONE|TWO|THREE

    I've had the most success that way.
  • Options
    hjanumhjanum Posts: 110 ✭✭
    Sorry for the delay in the response, got busy on other projects.
    I assume that you mean something along the lines of:



    Unfortunately, this does not have the same semantic meaning.

    The string "ONE ONE ONE" would match, whereas it would not match the positive lookahead extraction.
    I suppose you could do something along the lines of:



    Then add the N! permutations of the expression under a parent extractor. In this case N=3, so there are only 6 permutations. This is probably doable, but if we are looking for five words N=5, then there are 120 permutations.

Sign In or Register to comment.