Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How I can remove characters between < and > using regex in c#?

Tags:

string

c#

regex

I have a string str="<u>rag</u>". Now, i want to get the string "rag" only. How can I get it using regex?

My code is here..

I got the output=""

Thanks in advance..

C# code:

string input="<u>ragu</u>";
string regex = "(\\<.*\\>)";
string output = Regex.Replace(input, regex, "");
like image 478
ragu Avatar asked Dec 21 '22 07:12

ragu


1 Answers

const string HTML_TAG_PATTERN = "<.*?>";
Regex.Replace (str, HTML_TAG_PATTERN, string.Empty);
like image 171
vborutenko Avatar answered Jan 09 '23 19:01

vborutenko