23
1
using System;
2
using System.Text.RegularExpressions;
3
4
public class Program
5
{
6
public static void Main()
7
{
8
string regexPattern = @"hello";
9
Regex regex = new Regex(regexPattern);
10
string inputString = "hello world!";
11
12
Match match = regex.Match(inputString);
13
14
if (match.Success)
15
{
16
Console.WriteLine("Match found at index {0} with length {1}", match.Index, match.Length);
17
}
18
else
19
{
20
Console.WriteLine("No match found.");
21
}
22
}
23
}
Cached Result
Введите количество элементов массива
>