0

Consider these Regexes written in Julia (they should be equivalent in Python):

φ = Regex("(?:[X](I*)){$n,}(?:5|6{$m,}|\\\$)")
ζ = Regex("(?:[X](I*)){$n,}(?:[5](I*){$m,}|6{$m,}|\\\$)")

They operate on a language $\Sigma = \{X, I, 5, 6\}$. They find patterns that consist of

  • occurrences of $2, 3, 4, I$ (in any order) where total number of $2$s, $3$s and $4$s is at least $n$, as long as these occurrences end with a $m$ repetitions of character $5$ or $m$ repetitions of character $6$.

The difference between the first and second regex is that the first does not impose the condition that the sequence ends with more than $1$ repetitions of 5.

What are their equivalent regular expressions?

lafinur
  • 195
  • 3

1 Answers1

0

I think this is what you are looking for: $I^*(2I^* + 3I^* + 4I^*)^n(2I^* + 3I^* + 4I^*)^*(5^m + 6^m)$

codeR
  • 1,983
  • 7
  • 17