whoah
whoah

Reputation: 4443

Change text in regex to upper-case

I have a problem. How can I change text between "<" and ">" (HTML tags), to upper-case letters? Part of code:

string a= @"<html><b>hello world!</b>
<table>test</table></html>";
a = Regex.Replace(a, @"<(.|\n)*?>", String.Empty);

Now, output is:

hello world!
test

And I want to have:

<HTML><B>hello world!</B>
<TABLE>test</TABLE></HTML>

I know that String.Empty delete code between < >, but how to change this text to upper-case letters? Just give me some advice, how to do it.

Greetings!

Upvotes: 3

Views: 1515

Answers (1)

L.B
L.B

Reputation: 116128

a = Regex.Replace(a, @"<(.|\n)*?>", m=>m.Value.ToUpper());

Upvotes: 6

Related Questions