به نام خدا سلام بر برنامه نویسان عزیز 😉 در این پست آموزش Regex:پیدا کردن کلمه ای که عبارت ai دارد در #C را آماده کردم. انشاالله که این کد براتون مفید باشه.
خروجی این کد به این صورت است:
Matching words that contain the pattern 'ai'
using the following regular expression: \S*(ai)\S*
curtain
pertain
using the following regular expression: \S*(ai)\S*
curtain
pertain
کد Regex:پیدا کردن کلمه ای که عبارت ai دارد در #C :
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);