0
I need to colorize a text in Richtextbox before a string For example:
"Highlight: normal highlight"
0
I need to colorize a text in Richtextbox before a string For example:
"Highlight: normal highlight"
5
See if this can help you
private void ColourRrbText(RichTextBox rtb)
{
Regex regExp = new Regex("^([^:]*)");
foreach (Match match in regExp.Matches(rtb.Text))
{
rtb.Select(match.Index, match.Length);
rtb.SelectionColor = Color.Blue;
}
}
I needed to do this while the person type, and in Richtextbox it will have several lines and not just one line. Is there any way to do this while the person type or :
?
@Sérgiohenrique It would be good if you said that in the question
Browser other questions tagged c# winforms richtextbox
You are not signed in. Login or sign up in order to post.
The text after the
:
should be interpreted as a regex or as a literal? For example, if the text has a?
it must match with a query (literal) or be interpreted as an optional operator of the previous Pattern (regex)?– Gabriel
Only the
:
that limits the text before, after it any text can be literal.– sYsTeM