Güncel C# Regex ile Tüm Eşleşmeleri Bulma

  • Konuyu Başlatan Konuyu Başlatan Falcon
  • Başlangıç tarihi Başlangıç tarihi

Falcon

Yönetici
Kod:
using System;
using System.Text.RegularExpressions;

class Program
{
    static void Main()
    {
        string text = "Yaşlar: 25, 34 ve 42.";
        string pattern = @"\d+"; // Sayıları eşleştiren regex

        MatchCollection matches = Regex.Matches(text, pattern);

        foreach (Match match in matches)
        {
            Console.WriteLine(match.Value);  // Çıktı: 25, 34, 42
        }
    }
}
 
Geri
Üst