Exemplo n.º 1
1
		/// <summary>
		/// Load the specified line in the parser.
		/// </summary>
		/// <param name="line"></param>
		public void LoadLine(string line)
		{
			if (mRegEx == null)
				mRegEx = CreateLineRegExp();

			mRegExMatch = mRegEx.Match(line);
		}
Exemplo n.º 2
1
        // Get the SymbolPalette by deserializing the SymbolPalette file
        public SymbolPalette LoadPalette(string filepath)
        {
            SymbolPalette curSymbolPalette = null;
            FileStream    iStream          = new FileStream(filepath, FileMode.Open, FileAccess.Read);

            if (iStream != null)
            {
                IFormatter formatter = new BinaryFormatter();
                formatter.Binder = new OldToNewDeserializationBinder();
                try
                {
                    AppDomain.CurrentDomain.AssemblyResolve +=
                        new ResolveEventHandler(DiagramBaseAssembly.AssemblyResolver);
                    curSymbolPalette = (SymbolPalette)formatter.Deserialize(iStream);
                }
                catch (SerializationException)
                {
                    try
                    {
                        formatter        = new BinaryFormatter();
                        formatter.Binder = new OldToNewDeserializationBinder();
                        iStream.Position = 0;
                        curSymbolPalette = (SymbolPalette)formatter.Deserialize(iStream);
                    }
                    catch (Exception se)
                    {
                        // To get the version from the edp file
                        string strRegex = @"version\w*=\w*\d+\.\d+\.\d+(\.\d+)+\w*,";
                        System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(strRegex, System.Text.RegularExpressions.RegexOptions.IgnoreCase | System.Text.RegularExpressions.RegexOptions.Singleline);
                        StreamReader sr             = File.OpenText(filepath);
                        string       strFileContent = sr.ReadToEnd();
                        System.Text.RegularExpressions.Match version = regex.Match(strFileContent);
                        string strVersion = version.Value;

                        if (string.IsNullOrEmpty(strVersion))
                        {
                            throw new System.Exception("Incompatible with older version.\nPlease use the converter utility to make it compatible with newer version", se);
                        }
                        else
                        {
                            throw new System.Exception("Unable to parse the palette file " + strVersion, se);
                        }
                    }
                }
                finally
                {
                    iStream.Close();
                    AppDomain.CurrentDomain.AssemblyResolve -=
                        new ResolveEventHandler(DiagramBaseAssembly.AssemblyResolver);
                }
            }
            return(curSymbolPalette);
        }
Exemplo n.º 3
1
 /**
  * Same as String.IndexOf, except one can specify which incidence to return, if there are multiple.
  *
  * @param strInput
  *   The string to look inside.
  * @param strFind
  *   The string to find in the input string.
  * @param intN
  *   The incidence to return the position of.
  *
  * @return
  *   If found, the position of the string will be returned. If not, -1 will be returned.
  */
 public static int getNth(string strInput, string strFind, int intN)
 {
     System.Text.RegularExpressions.Match matMatch = System.Text.RegularExpressions.Regex.Match(strInput, "((" + strFind + ").*?){" + intN + "}");
     if (matMatch.Success)
     {
         return(matMatch.Groups[2].Captures[intN - 1].Index);
     }
     else
     {
         return(-1);
     }
 }
 private static System.Collections.Generic.Dictionary <string, string> getParameters(string param)
 {
     System.Text.RegularExpressions.Regex myRegex = new System.Text.RegularExpressions.Regex("(?:\\s*)(?<=[-|/])(?<name>\\w*)[:|=](\"((?<value>.*?)(?<!\\\\)\")|(?<value>[\\w]*))");
     System.Text.RegularExpressions.Match m       = myRegex.Match(param);
     System.Collections.Generic.Dictionary <string, string> result = new System.Collections.Generic.Dictionary <string, string>();
     while (m.Success)
     {
         result.Add(m.Groups[3].Value, m.Groups[4].Value);
         m = m.NextMatch();
     }
     return(result);
 }
Exemplo n.º 5
0
 public static Vector2 ConvertToVector2(String str)
 {
     System.Text.RegularExpressions.Regex Elems = new System.Text.RegularExpressions.Regex(@"^(?<X>\S+)\s(?<Y>\S+)$");
     System.Text.RegularExpressions.Match Match = Elems.Match(str);
     if (!Match.Success)
     {
         throw new System.FormatException();
     }
     return(new Vector2(
                Convert.ToSingle(Match.Groups["X"].Value),
                Convert.ToSingle(Match.Groups["Y"].Value)));
 }
Exemplo n.º 6
0
        /// <summary>
        /// 从指定内容中提取
        /// </summary>
        /// <param name="content">内容</param>
        /// <param name="rex">正则表达式</param>
        /// <returns></returns>
        public ArrayList GetParts(string content, string rex)
        {
            ArrayList list = new ArrayList();

            System.Text.RegularExpressions.Regex r = new System.Text.RegularExpressions.Regex(rex, System.Text.RegularExpressions.RegexOptions.Compiled | System.Text.RegularExpressions.RegexOptions.IgnoreCase);
            System.Text.RegularExpressions.Match m = r.Match(content);
            for (m = r.Match(content); m.Success; m = m.NextMatch())
            {
                list.Add(m.Groups[1].Value);
            }
            return(list);
        }
Exemplo n.º 7
0
        private bool CheckInput(string inputString)
        {
            bool flag = false;

            System.Text.RegularExpressions.Regex r = new System.Text.RegularExpressions.Regex(@"[a-fA-F0-9.\s]+");
            System.Text.RegularExpressions.Match m = r.Match(inputString);
            if (m.Success && m.Value == inputString)
            {
                flag = true;
            }
            return(flag);
        }
Exemplo n.º 8
0
        public static bool IsValidEMail(this string source)
        {
            if (source.IsNull())
            {
                return(false);
            }

            System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$");
            System.Text.RegularExpressions.Match match = regex.Match(source);

            return(match.Success);
        }
Exemplo n.º 9
0
        /// <summary>
        ///  通过实现 System.Web.IHttpHandler 接口的自定义 HttpHandler 启用 HTTP Web 请求的处理。
        /// </summary>
        /// <param name="context">System.Web.HttpContext 对象,它提供对用于为 HTTP 请求提供服务的内部服务器对象(如 Request、Response、Session  和 Server)的引用。</param>
        public void ProcessRequest(HttpContext context)
        {
            //取得原始URL屏蔽掉参数
            string Url = context.Request.RawUrl;

            System.Xml.XmlDocument Dom = new System.Xml.XmlDocument();
            Dom.Load(HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["urlRewriter"]));//从web.config读取设置文件URLRewriterSettings.xml的路径
            System.Xml.XmlNodeList ItemList = Dom.SelectSingleNode(@"//URLRewriters").ChildNodes;
            foreach (System.Xml.XmlNode Node in ItemList)
            {
                //if(!Node.HasChildNodes) continue;
                String Ph = "";
                Ph = Node.Attributes.GetNamedItem(@"Path").InnerText;
                Rh = Node.Attributes.GetNamedItem(@"RealPath").InnerText;
                if (Ph.StartsWith(@"~"))
                {
                    Ph = HttpContext.Current.Request.ApplicationPath + Ph.Substring(1);
                }
                if (Rh.StartsWith(@"~"))
                {
                    Rh = HttpContext.Current.Request.ApplicationPath + Rh.Substring(1);
                }
                //建立正则表达式
                System.Text.RegularExpressions.Regex Reg = new System.Text.RegularExpressions.Regex(Ph, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                System.Text.RegularExpressions.Match m   = Reg.Match(Url); //匹配
                if (m.Success)                                             //成功
                {
                    for (int i = 1; i <= m.Groups.Count; i++)
                    {
                        Rh = Rh.Replace("$" + i.ToString(), m.Groups[i].Value);
                    }

                    //Context.Response.Write(Context.Request.Url.PathAndQuery);
                    //Context.RewritePath(RealPath);//(RewritePath 用在无 Cookie 会话状态中。)

                    context.Server.Execute(Rh);
                    //Context.Response.Write(Rh);
                    context.Response.End();
                    break;
                }
            }
            try
            {
                context.Server.Execute(context.Request.Url.PathAndQuery);
            }
            catch
            {
                TongUse TextData = new TongUse();
                // TextData.Err("在获取文件时出现错误,文件没有找到"+ex.Message);
                TextData.Res.Response.Write(context.Request.Url.PathAndQuery);
                context.Response.End();
            }
        }
 protected void ValidateName(string aName)
 {
     if (String.IsNullOrEmpty(aName))
     {
         throw new ArgumentNullException("Property name can not be null or empty");
     }
     System.Text.RegularExpressions.Match lMatch = System.Text.RegularExpressions.Regex.Match(aName, "[a-zA-Z_]([a-zA-Z0-9_])*");
     if (lMatch == null || !lMatch.Success || lMatch.ToString() != aName)
     {
         throw new ArgumentException(String.Format("'{0}' is an invalid property name.", aName));
     }
 }
Exemplo n.º 11
0
        private void AddRange(HttpRequestMessage r, string range)
        {
            System.Text.RegularExpressions.Match m = System.Text.RegularExpressions.Regex.Match(range, "=(\\d+)-(\\d+)$");
            if (!m.Success)
            {
                return;
            }

            int from = Convert.ToInt32(m.Groups[1].Value);
            int to   = Convert.ToInt32(m.Groups[2].Value);
            //r.Headers.Range.Ranges.Add(new System.Net.Http.Headers.RangeItemHeaderValue(from, to));
        }
Exemplo n.º 12
0
        /// <summary> Parse version file (like vGDMO.ini) </summary>
        /// <param name="text">Version file content</param>
        /// <returns> Version (integer) or -1 if version not found </returns>
        private static int GetVersion(string text)
        {
            string expr = "(version)(=)(\\d+)";

            System.Text.RegularExpressions.Regex r = new System.Text.RegularExpressions.Regex(expr, System.Text.RegularExpressions.RegexOptions.IgnoreCase | System.Text.RegularExpressions.RegexOptions.Singleline);
            System.Text.RegularExpressions.Match m = r.Match(text);
            if (m.Success)
            {
                return(Convert.ToInt32(m.Groups[3].ToString()));
            }
            return(-1);
        }
Exemplo n.º 13
0
        private string validate_eMaillist(string emailList)
        {
            string strData = emailList;

            emailList = "";
            //splitting and validating email ids one by one
            string[] separator   = new string[] { ",", ";", "/", ":", " ", "\r\n", "*", "#", "|", "!", "'", "$", "%", "^", "&", "(", ")", "+", "=", "~", "?", "<", ">", "`" };
            string[] strSplitArr = strData.Split(separator, StringSplitOptions.RemoveEmptyEntries);
            bool     iSvalid     = true;

            foreach (string arrStr in strSplitArr)
            {
                System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(@"^(([\w-]+\.)+[\w-]+|([a-zA-Z]{1}|[\w-]{2,}))@"
                                                                                                      + @"((([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\.([0-1]?
				[0-9]{1,2}|25[0-5]|2[0-4][0-9])\."
                                                                                                      + @"([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\.([0-1]?
				[0-9]{1,2}|25[0-5]|2[0-4][0-9])){1}|"
                                                                                                      + @"([a-zA-Z]+[\w-]+\.)+[a-zA-Z]{2,4})$");
                System.Text.RegularExpressions.Match match = regex.Match(arrStr);
                if (match.Success)
                {
                    try
                    {
                        MailAddress m = new MailAddress(arrStr);
                        iSvalid = true;
                    }
                    catch (FormatException)
                    { iSvalid = false; }
                }
                else
                {
                    iSvalid = false;
                }

                if (iSvalid)
                {
                    //if ((i == strSplitArr.Length - 1))
                    //{
                    //    emailList += arrStr;
                    //}
                    //else
                    { emailList += arrStr + ","; }
                }
                else
                {
                    inValidCount++; INvalidrecp += arrStr + "<br>";
                }
                i++;
            }
            emailList = emailList.TrimEnd(',', ';');
            return(emailList);
        }
Exemplo n.º 14
0
        }     // End Sub ReplaceTextInFile

        static void ReplaceGithubUser(string userName, string fileName)
        {
            string inputText = System.IO.File.ReadAllText(fileName);
            string attribute = System.Text.RegularExpressions.Regex.Escape("https://" + userName + ":")
                               + ".+"
                               + System.Text.RegularExpressions.Regex.Escape("@github.com");

            string pattern = @"^(\s*url\s*=\s*)(" + attribute + ")(.*)$";

            // System.Text.RegularExpressions.Regex.Unescape("test");

            System.Text.RegularExpressions.Match match =
                System.Text.RegularExpressions.Regex.Match(inputText, pattern,
                                                           System.Text.RegularExpressions.RegexOptions.IgnoreCase
                                                           | System.Text.RegularExpressions.RegexOptions.Multiline
                                                           );


            if (match.Success)
            {
                System.Console.WriteLine($"Match-Index: {match.Index}");
                System.Console.WriteLine($"Match-Length: {match.Length}");

                foreach (System.Text.RegularExpressions.Capture capture in match.Captures)
                {
                    System.Console.WriteLine("Index={0}, Value={1}", capture.Index, capture.Value);
                } // Next capture
            }     // End if (match.Success)

#if false
            string crap = System.Text.RegularExpressions.Regex.Replace(inputText, pattern, "https://github.com",
                                                                       System.Text.RegularExpressions.RegexOptions.IgnoreCase
                                                                       | System.Text.RegularExpressions.RegexOptions.Multiline);
            System.Console.WriteLine(crap);
#endif


            string outputText = System.Text.RegularExpressions.Regex.Replace(inputText, pattern,
                                                                             new System.Text.RegularExpressions.MatchEvaluator(
                                                                                 delegate(System.Text.RegularExpressions.Match pmatch)
            {
                string r = pmatch.Groups[1].Value + "https://github.com" + pmatch.Groups[3].Value;
                return(r);
            }
                                                                                 )
                                                                             , System.Text.RegularExpressions.RegexOptions.IgnoreCase
                                                                             | System.Text.RegularExpressions.RegexOptions.Multiline
                                                                             );

            System.Console.WriteLine(outputText);
            ReplaceTextInFile(fileName, outputText);
        } // End Sub ReplaceGithubUser
Exemplo n.º 15
0
        /// <summary>
        /// 验证15位的身份证格式与合法性,并输出身份证信息(地区,出生年月日,性别)
        /// </summary>
        /// <param name="sCardId">身份证卡号</param>
        /// <returns></returns>
        private static bool CheckCid_15(string sCardId)
        {
            string[] cardMessage;
            //河南省开头是 41 且没有00 01 02 等开头的省份,北京市是11,故按照下面的方式构造数组
            string[] aCity = new string[]
            {
                null, null, null, null, null, null, null, null, null, null, null, //00 - 10
                "北京", "天津", "河北", "山西", "内蒙古",                                    //11 - 15
                null, null, null, null, null,                                     //16 - 20
                "辽宁", "吉林", "黑龙江",                                                //21 - 23
                null, null, null, null, null, null, null,                         //24 - 30
                "上海", "江苏", "浙江", "安微", "福建", "江西", "山东",                         //31 - 37
                null, null, null,                                                 //38 - 40
                "河南", "湖北", "湖南", "广东", "广西", "海南",                               //41 - 47
                null, null, null,                                                 //48 - 50
                "重庆", "四川", "贵州", "云南", "西藏",                                     //51 - 55
                null, null, null, null, null, null,                               //56 - 60
                "陕西", "甘肃", "青海", "宁夏", "新疆",                                     //61 - 65
                null, null, null, null, null,                                     //66 - 70
                "台湾",                                                             //71
                null, null, null, null, null, null, null, null, null,             //72 - 80
                "香港", "澳门",                                                       //81 82
                null, null, null, null, null, null, null, null,                   //83 - 90
                "国外"                                                              //91
            };
            //构造正则表达式对象
            System.Text.RegularExpressions.Regex rg = new System.Text.RegularExpressions.Regex(@"^\d{15}$");
            System.Text.RegularExpressions.Match mc = rg.Match(sCardId);
            if (!mc.Success) //匹配失败
            {
                cardMessage = new string[] { "身份证信息不合法" };
                return(false);
            }
            sCardId = sCardId.ToLower();
            sCardId = sCardId.Replace("x", "a");
            if (aCity[int.Parse(sCardId.Substring(0, 2))] == null)
            {
                cardMessage = new string[] { "非法地区" };
                return(false);
            }
            string   borth = sCardId.Substring(6, 6).Insert(4, "-").Insert(2, "-");
            DateTime borthTest;

            if (!DateTime.TryParse(borth, out borthTest))
            {
                cardMessage = new string[] { "非法生日" };
                return(false);
            }
            //地区、生日、性别
            cardMessage = new string[] { aCity[int.Parse(sCardId.Substring(0, 2))], borth, (int.Parse(sCardId.Substring(13, 1)) % 2 == 1 ? "男" : "女") };
            return(true);
        }
Exemplo n.º 16
0
        private void AddRange(HttpWebRequest r, string range)
        {
            System.Text.RegularExpressions.Match m = System.Text.RegularExpressions.Regex.Match(range, "=(\\d+)-(\\d+)$");
            if (!m.Success)
            {
                return;
            }

            int from = Convert.ToInt32(m.Groups[1].Value);
            int to   = Convert.ToInt32(m.Groups[2].Value);

            r.AddRange(from, to);
        }
Exemplo n.º 17
0
        private void ValidPathSpecialChar()
        {
            //特殊字符校验
            string regex = "(\\*$)";// @"(.*\.*)(.*\*.*)(?=.*/)";

            System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(regex);
            string input = @"张郭\三风";//判断是否含有某某字符

            System.Text.RegularExpressions.Match mc = reg.Match(input);
            if (mc.Groups.Count > 1)
            {
            }
        }
Exemplo n.º 18
0
        private void ZIPTB_LostFocus(object sender, RoutedEventArgs e)
        {
            System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(@"^\d{4}$");
            System.Text.RegularExpressions.Match match = regex.Match(ZIPTB.Text);

            if (match.Success)
            {
            }
            else
            {
                MessageBox.Show("Bitte geben Sie eine gültige PLZ ein!");
            }
        }
 public static bool validPhone(String phoneString)
 {
     System.Text.RegularExpressions.Match match =
         System.Text.RegularExpressions.Regex.Match(phoneString, @"^\(\d{2}\)\d{4}-\d{4}$");
     if (!match.Success)
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
Exemplo n.º 20
0
 private void TxtPreis_LostFocus(object sender, RoutedEventArgs e)
 {
     System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(@"([0-9]+(?:\.(?:[1-9][1-9]|[0-9][1-9]|[1-9][0-9]))?)(?=[^0-9])");
     System.Text.RegularExpressions.Match match = regex.Match(txtPreis.Text);
     if (!match.Success)
     {
         lblPreis.Background = new SolidColorBrush(Colors.Red);
     }
     else
     {
         lblPreis.Background = new SolidColorBrush(Colors.Transparent);
     }
 }
Exemplo n.º 21
0
        private void BusinessNrTB_LostFocus(object sender, RoutedEventArgs e)
        {
            System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(@"^(((((\+)?(\s)?(\d{2,4}))(\s)?((\(0\))?)(\s)?|0)(\s|\-)?)(\s|\d{2})(\s|\-)?)?(\d{3})(\s|\-)?(\d{2})(\s|\-)?(\d{2})");
            System.Text.RegularExpressions.Match match = regex.Match(BusinessNrTB.Text);

            if (match.Success)
            {
            }
            else
            {
                MessageBox.Show("Bitte geben Sie eine gültige Telefonnummer ein!");
            }
        }
Exemplo n.º 22
0
        public string GetLetter()
        {
            string result = null;

            System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(ReportNoLetterPattern);
            System.Text.RegularExpressions.Match match = regex.Match(this.m_Value);
            if (match.Captures.Count != 0)
            {
                result = match.Groups["ReportNoLetter"].Captures[0].Value;
            }

            return(result);
        }
Exemplo n.º 23
0
        private string FromPcapName(string pcapName)
        {
            System.Text.RegularExpressions.Regex regex =
                new System.Text.RegularExpressions.Regex("{.*}");
            System.Text.RegularExpressions.Match match =
                regex.Match(pcapName);

            if (match.Success)
            {
                return(match.Value);
            }
            return(pcapName);
        }
Exemplo n.º 24
0
        public void DeleteSpecifieSheet(string StrRegex)
        {
            foreach (Worksheet sht in wb.Sheets)

            {
                System.Text.RegularExpressions.Match m = System.Text.RegularExpressions.Regex.Match(sht.Name, StrRegex);//\.*Linksave\.*Templat

                if (m.Success)
                {
                    sht.Delete();
                }
            }
        }
Exemplo n.º 25
0
 private bool IsIntNum(string numText)
 {
     System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex("^[0-9]+$");              //判断是不是数据,要不是就表示没有选择,则从隐藏域里读出来
     System.Text.RegularExpressions.Match ma  = reg.Match(numText);
     if (ma.Success)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 26
0
        /// <summary>
        /// get the branch part of the given path.
        /// </summary>
        /// <remarks>
        /// $/IGT_0803/development/dev_adv_cr/EGS/shared/lib/win32/PinUtil.dll
        ///
        /// $/IGT_0803/development/dev_adv_cr/EGS/
        /// </remarks>
        /// <param name="fullPath"></param>
        /// <returns></returns>
        public static string GetEGSBranch(string fullPath)
        {
            string path = string.Empty;

            System.Text.RegularExpressions.Match match = _egsRE.Match(fullPath);

            if (match != null && match.Success)
            {
                path = match.Groups[1].Value;
            }

            return(path);
        }
Exemplo n.º 27
0
 public static bool TryParseDate2(string date, out System.DateTime result)
 {
     result = default;
     foreach (string s in regexstrings)
     {
         System.Text.RegularExpressions.Match m = System.Text.RegularExpressions.Regex.Match(date, s);
         if (System.DateTime.TryParse(m.Value, out result))
         {
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 28
0
        // Rfc3164SyslogMessage.IsRfc3164SyslogMessage
        public static bool IsRfc3164SyslogMessage(string syslogMessage)
        {
            System.Text.RegularExpressions.Regex _re =
                new System.Text.RegularExpressions.Regex(
                    RegexExpression
                    , System.Text.RegularExpressions.RegexOptions.IgnorePatternWhitespace
                    | System.Text.RegularExpressions.RegexOptions.Singleline
                    | System.Text.RegularExpressions.RegexOptions.Compiled
                    );

            System.Text.RegularExpressions.Match m = _re.Match(syslogMessage);
            return(m.Success);
        }
Exemplo n.º 29
0
        private void EmailTB_LostFocus(object sender, RoutedEventArgs e)
        {
            System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(@"^(\D)+(\w)*((\.(\w)+)?)+@(\D)+(\w)*((\.(\D)+(\w)*)+)?(\.)[a-z]{2,}$");
            System.Text.RegularExpressions.Match match = regex.Match(EmailTB.Text);

            if (match.Success)
            {
            }
            else
            {
                MessageBox.Show("Bitte geben Sie eine gültige Email ein!");
            }
        }
Exemplo n.º 30
0
 //TODO: Find an efficient way to evaluate the text using the tree.
 /// <summary>Check if the text follows the rules by the regex</summary>
 /// <param name="text">The text to evaluate</param>
 /// <returns>True if the text is correct, otherwise false</returns>
 public bool Evaluate(string text)
 {
     System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(@"(((SETS)((\t|\s)*(\n))+((\t|\s)*[A-Z]+(\t|\s)*=(\t|\s)*((('.')|(CHR\([0-9]+\)))((\.\.)(('.')|(CHR\([0-9]+\))))?(\+(('.')|(CHR\([0-9]+\)))((\.\.)(('.')|(CHR\([0-9]+\))))?)*)((\t|\s)*(\n))+)+)?)((\n)*(TOKENS)((\t|\s)*(\n))+((\t|\s)*(TOKEN)(\t|\s)+[0-9]+(\t|\s)*=(\t|\s)*(.)+((\t|\s)*(\n))+)+)((\n)*(ACTIONS)((\t|\s)*(\n))+((\t|\s)*(RESERVADAS\(\))((\t|\s)*(\n))+{((\t|\s)*(\n))+((\t|\s)*[0-9]+(\t|\s)*=(\t|\s)*'.+'((\t|\s)*(\n))+)+}((\t|\s)*(\n))+))(((\t|\s)*(\n))+([A-Z]+\(\))((\t|\s)*(\n))+{((\t|\s)*(\n)+)(\t|\s)*[0-9]+(\t|\s)*=(\t|\s)*'.+'((\t|\s)*(\n))+})*((\t|\s)*(\n)*[A-Z]*ERROR(\t|\s)*=(\t|\s)*[0-9]+(\t|\s)*(\n)*)+");
     System.Text.RegularExpressions.Match match = regex.Match(text);
     if (match.Success)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 31
0
 private string GetNumberDefaultValue(string val, string suffix)
 {
     System.Text.RegularExpressions.Match m = System.Text.RegularExpressions.Regex.Match(val, @"-?\d+(\.\d+)?");
     if (m.Success)
     {
         val = m.Value + suffix;
     }
     else
     {
         val = "";
     }
     return(val);
 }
Exemplo n.º 32
0
 public bool MoveNext()
 {
     if (this._done)
     {
         return false;
     }
     this._match = this._matchcoll.GetMatch(this._curindex++);
     if (this._match == null)
     {
         this._done = true;
         return false;
     }
     return true;
 }
Exemplo n.º 33
0
 internal Match(System.Text.RegularExpressions.Match value, string matched)
     : base(Ruby.Runtime.Init.rb_cMatch)
 {
     this.value = value;
     this.matched = matched;
 }
Exemplo n.º 34
0
 /// <summary>
 /// Sets the deprecated RegExp properties.
 /// </summary>
 /// <param name="input"> The string against which a regular expression is matched. </param>
 /// <param name="match"> The regular expression match to base the properties on. </param>
 internal void SetDeprecatedProperties(string input, System.Text.RegularExpressions.Match match)
 {
     this.lastInput = input;
     this.lastMatch = match;
 }
Exemplo n.º 35
0
        //-------------------------------------------------------------------------------

        public Match(Class klass)
            : base(klass) 
        {
            this.value = null;
            this.matched = null;
        }
 protected override object GetTenantId(RegularExpressionsMatch urlMatch)
 {
     return urlMatch.Success
         ? TenantId
         : null;
 }
Exemplo n.º 37
0
 public bool FindNext(bool exec_goto_action=true)
 {
     Form1 = (Form1)this.Owner;
     UpdateLastWordsList(this.tbTextToFind);
     if (exec_goto_action)
         startOffset = Form1.CurrentSyntaxEditor.TextEditor.ActiveTextAreaControl.TextArea.Caret.Offset;
     if (cbSearchUp.Checked && resLength >= 0)
         startOffset -= resLength;
     resOffset = -1;
     //resLength = -1;
     System.Text.RegularExpressions.RegexOptions options = System.Text.RegularExpressions.RegexOptions.None;
     if (!cbMathCase.Checked)
         options = options | System.Text.RegularExpressions.RegexOptions.IgnoreCase;
     if (cbSearchUp.Checked)
         options = options | System.Text.RegularExpressions.RegexOptions.RightToLeft;
     string pattern = this.tbTextToFind.Text;
     if (pattern == "")
     {
         findSuccess = false;
         return findSuccess;
     }
     if (!cbUseRegex.Checked)
         pattern = System.Text.RegularExpressions.Regex.Escape(pattern);
     if (cbMathWord.Checked)
         pattern = @"\b" + pattern + @"\b";
     System.Text.RegularExpressions.Regex Regex;
     try
     {
         Regex = new System.Text.RegularExpressions.Regex(pattern, options);
     }
     catch (Exception e)
     {
         MessageBox.Show(string.Format(PascalABCCompiler.StringResources.Get("VP_REPLACEFORM_REGEXPERR{0}"),e.Message), PascalABCCompiler.StringResources.Get("!ERROR"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
         findSuccess = false;
         return findSuccess;
     }
     if (cbSearchUp.Checked)
         Match = Regex.Match(Form1.CurrentSyntaxEditor.TextEditor.Document.TextContent, 0, startOffset);
     else
         Match = Regex.Match(Form1.CurrentSyntaxEditor.TextEditor.Document.TextContent, startOffset);
     
     if (findSuccess = Match.Success)
     {
         resOffset = Match.Index;
         resLength = Match.Length;
         //Point p = Form1.CurrentSyntaxEditor.TextEditor.Document.OffsetToPosition(resOffset);
         if (exec_goto_action)
         {
             ICSharpCode.TextEditor.TextLocation p = Form1.CurrentSyntaxEditor.TextEditor.Document.OffsetToPosition(resOffset);
             Form1.ExecuteSourceLocationAction(new PascalABCCompiler.SourceLocation(null, p.Y + 1, p.X + 1, p.Y + 1, p.X + resLength), VisualPascalABCPlugins.SourceLocationAction.FindSelection);
         }
         else
             startOffset = resOffset + resLength;
     }
     return findSuccess;
 }