/// <summary> /// register a synonym /// </summary> /// <param name="from">original word</param> /// <param name="to">converted word</param> public void Add(string from, string to) { var from2 = StrMatch.ReplaceMetaStr(from); Regex reg; if (from.EndsWith("#")) { from = from.Substring(0, from.Length - 1); from2 = from2.Substring(0, from2.Length - 1); reg = new Regex(string.Format("(^|[^A-Z0-9]){0}[0-9]+", from2), RegexOptions.IgnoreCase | RegexOptions.Compiled); } else { reg = new Regex(string.Format("(^|[^A-Z0-9]){0}($|[^A-Z0-9])", from2), RegexOptions.IgnoreCase | RegexOptions.Compiled); } _regs.Add(reg); _froms.Add(from); _tos.Add(to); }