.NET Framework                
            नियमित भाव (System.Text.RegularExpressions)
        
        
            
    खोज…
जाँचें कि क्या पैटर्न इनपुट से मेल खाता है
public bool Check()
{
    string input = "Hello World!";
    string pattern = @"H.ll. W.rld!";
    // true
    return Regex.IsMatch(input, pattern);
}
        पासिंग विकल्प
public bool Check()
{
    string input = "Hello World!";
    string pattern = @"H.ll. W.rld!";
    // true
    return Regex.IsMatch(input, pattern, RegexOptions.IgnoreCase | RegexOptions.Singleline);
}
        साधारण मैच और प्रतिस्थापित
public string Check()
{
    string input = "Hello World!";
    string pattern = @"W.rld";
    // Hello Stack Overflow!
    return Regex.Replace(input, pattern, "Stack Overflow");
}
        समूहों में मिलान करें
public string Check()
{
    string input = "Hello World!";
    string pattern = @"H.ll. (?<Subject>W.rld)!";
    Match match = Regex.Match(input, pattern);
    // World
    return match.Groups["Subject"].Value;
}
        स्ट्रिंग से गैर अल्फ़ान्यूमेरिक वर्ण निकालें
public string Remove()
{
    string input = "Hello./!";
    
    return Regex.Replace(input, "[^a-zA-Z0-9]", "");
}
        सभी मैच खोजें
का उपयोग करते हुए
using System.Text.RegularExpressions;
 कोड
static void Main(string[] args)
{
    string input = "Carrot Banana Apple Cherry Clementine Grape";
    // Find words that start with uppercase 'C'
    string pattern = @"\bC\w*\b";
    MatchCollection matches = Regex.Matches(input, pattern);
    foreach (Match m in matches)
        Console.WriteLine(m.Value);
}
 उत्पादन
Carrot
Cherry
Clementine
    
    
    
    
    Modified text is an extract of the original Stack Overflow Documentation
        के तहत लाइसेंस प्राप्त है CC BY-SA 3.0
        से संबद्ध नहीं है Stack Overflow