just want to ask the right expression for curly bracket
output should be all text inside { and ends with } will all be color blue . not a single line but all text inside curly brackets even if its different line .
further more something like this1:
int csharp = rtb.SelectionStart;
Regex bracket = new
Regex("\'[^\"]*\'");
foreach (Match brack in bracket.Matches(rtb.Text))
{
rtb.Select(brack.Index, brack.Length);
rtb.SelectionColor = Color.Blue;
rtb.SelectionStart = csharp;
rtb.SelectionColor = Color.Black;
}
expression above was for singlequote . all text inside ' ' (sample 'text') will all be color blue . i need for the curly brackets thanks .
starts with { and ends with }
这应该适合你:
Match match = Regex.Match(yourString, @"{[^}]*}");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.