Example #1
0
        // Function from file: 510.dm
        public dynamic Replace(dynamic text = null, string replacement = null)
        {
            string method = null;


            if (this.flags.Contains("g"))
            {
                if (this.flags.Contains("i"))
                {
                    method = "regex_replaceall";
                }
                else
                {
                    method = "regEx_replaceall";
                }
            }
            else if (this.flags.Contains("i"))
            {
                method = "regex_replace";
            }
            else
            {
                method = "regEx_replace";
            }
            return(Lang13.Call(Lang13.GetLibFunc("code/__HELPERS/bygex", method), text, this.pattern, replacement));
        }
Example #2
0
        // Function from file: 510.dm
        public void Find(dynamic text = null)
        {
            string  method  = null;
            dynamic results = null;
            ByTable L       = null;
            ByTable M       = null;
            dynamic i       = null;
            int     j       = 0;
            double? pos     = null;
            double? len     = null;


            if (this.flags.Contains("i"))
            {
                method = "regex_find";
            }
            else
            {
                method = "regEx_find";
            }
            results = Lang13.Call(Lang13.GetLibFunc("code/__HELPERS/bygex", method), text, this.pattern);
            L       = String13.ParseUrlParams(results);

            foreach (dynamic _a in Lang13.Enumerate(L))
            {
                i = _a;

                M = L[i];
                j = 2;

                while (j <= M.len)
                {
                    pos = String13.ParseNumber(M[j - 1]);
                    len = String13.ParseNumber(M[j]);
                    this.group.Add(String13.SubStr(text, ((int)(pos ?? 0)), ((int)((pos ?? 0) + (len ?? 0)))));
                    j += 2;
                }
            }
            return;
        }