We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

bUseRegex in EditControl.Find

The editcontrol function ''Find'' specifies an option for bUseRegex. I set it to true and set my ''str'' parameter to a regular expression, but get not results. Can I get some examples of using the Find function with regex.

1 Reply

AD Administrator Syncfusion Team November 4, 2004 02:08 PM UTC

Hi Willaim Here is a sample code snippet that you can add to any of the Essential Edit samples that ship: private void button1_Click(object sender, System.EventArgs e) { Regex rg = new Regex("&\\w{1,}"); string searchstr = (rg.Match(this.editControl1.GetString(this.editControl1.CurrentLine)).Value); if (searchstr=="") { MessageBox.Show("No Text matching the pattern found in Line: " + this.editControl1.CurrentLine.ToString()); } Syncfusion.Windows.Forms.Edit.EditLocationRange range = editControl1.Find(new Syncfusion.Windows.Forms.Edit.EditLocation(this.editControl1.CurrentLineChar.L,this.editControl1.CurrentLineChar.C),searchstr,false); this.editControl1.Select(range); this.editControl1.Focus(); } The thing to note is that you need pass the string that you want to find when you use the EditControl''s Find method. In this case it locates it finds a word beginning with a & in a particular line (like say &test). Regards Arun

Live Chat Icon For mobile
Up arrow icon