TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ryan Turney
NA
245
208.8k
Regex Help
Jul 26 2007 12:52 AM
Hello, first off can anyone recommend a good way to learn Regex? And second, how can I use Regex to change the color to red for anything between two quotation marks? This is what I have.
RichTextBox
rtb = (
RichTextBox
)_tabs.SelectedTab.Controls[0];
Regex
r =
new
Regex
(
"([\\t{}();])"
);
String
[] tokens = r.Split(line);
foreach
(
string
token
in
tokens)
{
if
token.StartsWith(
"\""
) && token.EndsWith(
"\""
))
{
int
index = line.IndexOf(
"\""
);
string
quote = line.Substring(index, line.Length);
rtb.SelectionColor =
Color
.Red;
rtb.SelectionFont =
new
Font
(
"Courier New"
, 10,
FontStyle
.Regular);
rtb.SelectedText = quote;
break
;
}
rtb.SelectedText = token;
}
Thanks
Reply
Answers (
1
)
Pass an Array from C# to javascript
GAC referencing incorrect version of assembly