سلام بر برنامه نویسان عزیز ایران زمین 😉 در این مطلب آموزش تشخیص کلماتی که با s شروع می شوند با Regex در سی شارپ #C را آماده کردم. انشاالله که این آموزش برای شما مفید باشد.
خروجی کد به این صورت می باشد :
Matching words that start with 's'
using the following regular expression: \bs\S*
static
start
she
using the following regular expression: \bs\S*
static
start
she
کد تشخیص کلماتی که با s شروع می شوند با Regex در سی شارپ #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);