syntax farvning via reg.exp
Hej...vil lave noget syntax farvning i en richtextbox via reg.exp.... det skal være til php, og skal indeholde noget som bold alt der er imellem "" og '', bold { og } og alle $blahblah skal have en anden farve...
det eneste jeg er nået frem til lige nu er...
Regex r;
Match m;
r = new Regex("(?:\")(.*?)(?:\")", RegexOptions.IgnoreCase|RegexOptions.Compiled);
for (m = r.Match(richTextBox1.Text); m.Success; m = m.NextMatch())
{
richTextBox1.Select(m.Groups[1].Index, m.Groups[1].Length);
richTextBox1.SelectionFont = new Font(richTextBox1.Font.Name, richTextBox1.Font.Size, FontStyle.Bold);
Console.WriteLine("Found href " + m.Groups[1] + " at "
+ m.Groups[1].Index);
}
r = new Regex("(?:\')(.*?)(?:\')", RegexOptions.IgnoreCase|RegexOptions.Compiled);
for (m = r.Match(richTextBox1.Text); m.Success; m = m.NextMatch())
{
richTextBox1.Select(m.Groups[1].Index, m.Groups[1].Length);
richTextBox1.SelectionFont = new Font(richTextBox1.Font.Name, richTextBox1.Font.Size, FontStyle.Bold);
Console.WriteLine("Found href " + m.Groups[1] + " at "
+ m.Groups[1].Index);
}
