写出奇数个a、偶数个b的正则表达式?

问题描述 投票:0回答:1

我有一个关于自动机理论和形式语言的问题。写出奇数个a和偶数个b的正则表达式? 2. Evan a 的个数和 b 的奇数个?

自动机理论中的正则表达式

regex automata formal-languages automata-theory
1个回答
0
投票

1 .对于奇数个 a's 和偶数个 b's :

  RE = (aa)*(bb)*a

This regular expression allows the odd number of a's and even number of b's . Ex: aaaabba

2 .对于偶数个 a's 和奇数个 b's :

 We can use the same concept as the above scenario

  RE = (aa)*(bb)*b

This expression allows even number of a's followed by odd number of b's .

如果有帮助请点赞,如有疑问请告诉我。

© www.soinside.com 2019 - 2024. All rights reserved.