110,550
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Collections.Generic;
using System.Text;
namespace Test
{
class Program
{
static void Main(string[] args)
{
string str = "aabb";
char[] c = str.ToCharArray(0,str.Length);
if (c[0] == c[1] && c[2] == c[3])
{
Console.WriteLine("正确");
}
else
{
Console.WriteLine("错误");
}
Console.ReadLine();
}
}
}
//AABB
(.)\1(.)\2
//AAAB
(.)\1\1.
//ABBB
.(.)\1\1
//ABAB
(.)(.)\1\2
//AABB
(.)\1((?!\1).)\2
//AAAB
(.)\1\1(?!\1).
//ABBB
(.)((?!\1).)\2\2
//ABAB
(.)((?!\1).)\1\2
//如果是判断包含
(.)\1(.)\2
//如果是判断整个字符串规则
^(.)\1(.)\2$