简体   繁体   English

正则表达式“以 a 开头并以 b 结尾的 a 和 b 数量相等的字符串”。

[英]Regex for "strings of equal number of a's and b's that beginns with an a and ending with b."r

I am trying to find regex for "strings of equal number of a's and b's that beginns with an a and ending with b."我正在尝试为“以 a 开头并以 b 结尾的相同数量的 a 和 b 的字符串”找到正则表达式。

Here is what i've done : https://regex101.com/r/6sEGqm/1/这是我所做的: https : //regex101.com/r/6sEGqm/1/

如果你不需要像abbaab这样的abbaab那么你去:

/^(?:ab)+?$/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM