I'm trying to find words like A.B where the subwords A and B are the same length.

This is my best attempt from my understanding of Qat:


Link to qat with this pattern.

However I get this error message:

Error: syntax error in length-only constraint

How can I achieve this in qat?

  • 5
    $\begingroup$ My gut tells me you may need to do this repeatedly for particular subword lengths of interest, e.g. by A;B;A.B;|A|=4;|B|=4 for a 9-letter word, changing the '4' values for others. I'm not sure there's a shorthand equivalent to '|A|=|B|' (but would be delighted to be wrong there). Don't forget to include the 'A;B;' if you also want the subwords to be dictionary words in their own right. $\endgroup$
    – Stiv
    Oct 27, 2022 at 10:54
  • $\begingroup$ @Stiv that's also my gut after trying a few different things, but likewise happy to be proven wrong. Good advice on how to do this manually $\endgroup$ Oct 27, 2022 at 11:16

1 Answer 1


@Stiv's gut appears to be correct. Looking at the Qat help page, this is what it says about length constraints:

A length constraint consists of a sequence of variables bounded on both sides by vertical bar characters |, followed by an equals sign, followed by a length specification as described under ‘Qualified patterns’ above (without the colon).

Recursively following the definitions from "Qualified patterns" to "Compound patterns" to "Simple patterns" to "Elements", variables are never mentioned. Remember that Qat won't let you put variables on the RHS anyways.

So, to make this work - to force the lengths of two variables to be equal - neither can go on the RHS of a length constraint. You'd need a special qualified pattern (say QP) to go there, one that had a fixed length between both |A|=QP and |B|=QP but was of variable length itself... which means it would have to be a variable, and we're back to the initial problem.

You can, as @Stiv said, simply hardcode a length in and then change it over several runs, as in A;B;A.B;|A|=4;|B|=4.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.