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