hello stackoverflow community!
i want match (same-length) string permutations of aab, want match:
aab baa aba but not:
abb ab aaba i have found many sources mentioning lookarounds , backreferences @ similar questions such [1] or [2] struggling repeated characters such "aa".
i have tried:
^(?=[aab]{3}$)(?!.*(.).*\1).*$ ^([aab])(?!\1)([aab])(?!\1|\2)([aab])(?!\1|\2|\3)$ do have ideas on that? in advance!
here's pattern matches 3 permutations:
^(?=.*b)(?=(.*a){2})...$ this pattern requires that:
- the length of string 3 (...)
- there 1
b(the(?=.*b)lookahead) - there 2
as (the(?=(.*a){2})lookahead)
but wouldn't simpler ^(aab|aba|baa)$ work?
Comments
Post a Comment