public MainPage()
        {
            InitializeComponent();
            UrlMapper.Implement.SimpleStringParameterBuilder builder = new UrlMapper.Implement.SimpleStringParameterBuilder();
            UrlMapper.Implement.SimpleStringParameter        praser  = builder.Parse(Pattern) as UrlMapper.Implement.SimpleStringParameter;
            var IsMatch = praser.IsMatched(Url);

            this.MyUrl.Text     = Url;
            this.MyPattern.Text = Pattern;
            this.MyIsMatch.Text = IsMatch.ToString();
        }
Пример #2
0
        static void Main(string[] args)
        {
            //var myPlattern = "something/aa{p1-no-data}bb/xx{p2-with-prefix}";
            //var myText = "something/aabb/xxthes";

            var myPlattern = "www.something.org/{p1}/{p2}/";
            var myText     = "www.something.org/1/2/";

            var builder  = new UrlMapper.Implement.SimpleStringParameterBuilder();
            var mypraser = builder.Parse(myPlattern) as SimpleStringParameter;
            var inMact   = mypraser.IsMatched(myText);

            if (inMact)
            {
                var dicResult = new Dictionary <string, string>();
                mypraser.ExtractVariables(myText, dicResult);
            }
            Console.WriteLine(inMact);
        }