Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Text.RegularExpressions;
- namespace ConsoleApp1
- {
- class Program
- {
- static bool test(string line)
- {
- Regex lineExtension = new Regex(@"\.(txt|(html|php))$");
- return lineExtension.IsMatch(line);
- }
- static void Main(string[] args)
- {
- Console.Write("Enter a line: ");
- Console.Write(test(Console.ReadLine()) ? "The line contains the extensions" : "The line does not contain the extensions");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement