به نام خدا سلام بر برنامه نویسان عزیز 😉 در این مطلب کد Regex : تشخیص کلماتی که 2 حرف یکسان کنارهم دارند در سی شارپ را آماده کردم. امیدوارم که این کد برای شما مفید باشد.
خروجی این کد به این صورت است:
Matching words that that contain two consecutive identical characters
using the following regular expression: \S*(.)\1\S*
Missisipli
Kerrisdale
using the following regular expression: \S*(.)\1\S*
Missisipli
Kerrisdale
کد Regex : تشخیص کلماتی که 2 حرف یکسان کنارهم دارند در سی شارپ :
using System;
using System.Text.RegularExpressions;
class MainClass {
private static void DisplayMatches(string text,string regularExpressionString) {
Console.WriteLine("using the following regular expression: " +regularExpressionString);
MatchCollection myMatchCollection = Regex.Matches(text, regularExpressionString);
foreach (Match myMatch in myMatchCollection) {
Console.WriteLine(myMatch);
using System.Text.RegularExpressions;
class MainClass {
private static void DisplayMatches(string text,string regularExpressionString) {
Console.WriteLine("using the following regular expression: " +regularExpressionString);
MatchCollection myMatchCollection = Regex.Matches(text, regularExpressionString);
foreach (Match myMatch in myMatchCollection) {
Console.WriteLine(myMatch);