Quantcast
Channel: Active questions tagged string-manipulation - Mathematica Stack Exchange
Viewing all articles
Browse latest Browse all 186

OrderlessPatternSequence for StringExpression

$
0
0

I am using v12.2.0. As a minimal example, the idea is to find all words that have two pairs of matching characters and two other characters for a total of 6 characters. The question is similar to 67518 (as I discovered later).

p1 = Alternatives @@    Permutations@StringExpression[a_, a_, c_, d_, b_, b_];p2 = Alternatives @@    Permutations@StringExpression[a_, a_, b_, c_, d_, b_];Sort[p1] === Sort[p2]DictionaryLookup[p1]DictionaryLookup[p2]

True

{}

{"eerier"}

Trying these patterns on the cloud gives results with 793 entries each. This seems like a bug for my version. So, I wanted to somehow incorporate the OrderlessPatternSequence.


Question

My question is whether StringExpression can be used in conjunction with OrderlessPatternSequence instead of relying on Permutations for such tasks? For more readability, can Repeated be incorporated with such a pattern?


Viewing all articles
Browse latest Browse all 186

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>