[英]Find Vowels using Regex
Looking for Maximum length of string which have maximum length with all vowels, 寻找所有元音具有最大长度的最大字符串长度,
For Example :- 例如 :-
aeiaaioooaauuaeiou
response :-
aeiou
aeeiou
aaaaeiou
aaeiou
aaeiou
aeiiou
...
aeiiooouuu
...
aeiiooouuu
But result will be (aeiiooouuu) 10, 但是结果将是(aeiiooouuu)10,
I'm unable to get single and repeted charater 我无法获得单打独斗的角色
My code :-
String str ="aeiaaioooaauuaeiou";
Pattern p = Pattern.compile("([aAeEiIoOuU])\\1{0,}");
Matcher m =p.matcher(str) ;
while (m.find()) {
System.out.println(m.group());
}
A more accurate pattern could be [aAeEiIoOuU]+
. 更准确的模式可以是
[aAeEiIoOuU]+
。 You might want to look at quantifiers in regular expressions. 您可能需要查看正则表达式中的量词 。 This pattern is greedy so it will return the largest possible match.
此模式是贪婪的,因此它将返回最大的匹配项。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.