using System;
using System.Text.RegularExpressions;

namespace 正则表达式
{
class Program
{
static void Main(string[] args)
{
string s = "I amwei";
string res = Regex.Replace(s,"^", "start");//"^"匹配开始字符串
Console.WriteLine(res);

        string res2 = Regex.Replace(s, "$", "end");//"$"匹配结尾
        Console.WriteLine(res2);

        string num = Console.ReadLine();
        /*bool isMatch = true;
        for (int i = 0; i < num.Length ; i++)
        {
            if(num[i]<'0'||num[i]>'9')
            {
                isMatch = false;
                break;
            }
        }
        if (isMatch)
        {
            Console.WriteLine("密码合法");
        }
        else
        {
            Console.WriteLine( "密码不合法");
        }*/
        string pattern = @"^\d*$";//(数字字符串)以数字开头0个或多个,并以数字结尾
        bool issMach = Regex.IsMatch(num, pattern);
        Console.WriteLine(issMach);

    }
}

}