new Lexem() { StartText = "hell(?=o)", IsRegex = true, LexemType = EditTokenType.Keyword, FormatName = "KeywordFormat" } |
public class CustomLanguage : ProceduralLanguageBase { private List<EditFormats> formats = new List<EditFormats>() { new EditFormats() { Foreground = Brushes.Red, FormatName = "KeywordFormat" } }; private List<Lexem> lexems = new List<Lexem>() { new Lexem() { StartText = "hell(?=o)", IsRegex = true, LexemType = EditTokenType.Keyword, FormatName = "KeywordFormat" } }; public CustomLanguage(EditControl control) : base(control) { Name = "Custom"; FileExtension = "cus"; ApplyColoring = true; SupportsIntellisense = false; SupportsOutlining = true; CaseSensitive = false; TextForeground = Brushes.Black; Lexem = new LexemCollection(lexems); Formats = new FormatsCollection(formats); } } |
public MainWindow() { InitializeComponent(); var customLanguage = new CustomLanguage(editControl1); editControl1.DocumentLanguage = Syncfusion.Windows.Edit.Languages.Custom; editControl1.CustomLanguage = customLanguage; } |
new Lexem() { StartText = "hell(?i)(o)", IsRegex = true, LexemType =EditTokenType.Keyword, FormatName = "KeywordFormat" }, |
Input | IsMatch | Formatted text |
hello | Yes | hello |
hellO | No | hellO |
hell | No | hell |
Hello | No | Hello |
Chello | Yes | Chello |