সাধারণত ব্যবহৃত ওয়াইল্ডকার্ড অক্ষর হল তারকাচিহ্ন (*)। এটি অক্ষরের একটি স্ট্রিংয়ে শূন্য বা তার বেশি অক্ষর উপস্থাপন করে।
নিম্নলিখিত উদাহরণে m দিয়ে শুরু এবং e −
দিয়ে শেষ হওয়া শব্দগুলিকে মেলাতে তারকাচিহ্ন ব্যবহার করা হয়েছে@”\bt\S*s\b”
নিম্নলিখিত সম্পূর্ণ কোড -
উদাহরণ
using System;
using System.Text.RegularExpressions;
namespace Demo {
public class Program {
private static void showMatch(string text, string expr) {
MatchCollection mc = Regex.Matches(text, expr);
foreach (Match m in mc) {
Console.WriteLine(m);
}
}
public static void Main(string[] args) {
string str = "toss cross tacos texas";
Console.WriteLine("Matching words that start with 't' and ends with 's':");
showMatch(str, @"\bt\S*s\b");
}
}
} আউটপুট
Matching words that start with 't' and ends with 's': toss tacos texas