コード例 #1
0
        /// <summary>
        /// 搜索多个目标
        /// </summary>
        /// <param name="strSearch">需要搜索的字符串</param>
        /// <returns>搜索到的目标字符串的位置</returns>
        public int[] SearchMulti(string strSearch)
        {
            _editor.MultipleSelection = true;
            var poses = System.Text.RegularExpressions.Regex.Matches(_editor.Text, strSearch).Cast <System.Text.RegularExpressions.Match>().Select(x => x.Index).ToArray();

            _editor.ClearSelections();
            foreach (var item in poses)
            {
                _editor.AddSelection(item, item + strSearch.Length);
            }

            return(poses);
        }