3
Answers

regex

Photo of ritika purwar

ritika purwar

10y
549
1
result = Regex.Replace(result, "/^\s*(&nbsp;)+/gi",/(&nbsp;|<br[^>]*>)+\s*$/gi);
this equivalent in c# ??? 

Answers (3)

0
Photo of Vulpes
NA 98.3k 1.5m 10y
ritika, 

What you've posted looks like a hybrid between C# and javascript.

Regex.Replace is a C# method but the regular expressions (if you remove the surrounding quotes on the first one) look like javascript.

If you're trying to convert javascript to C#, can you post the original javascript please.




0
Photo of ritika purwar
NA 0 12.8k 10y
this is nt wrkng....
0
Photo of Sibeesh Venu
NA 42.7k 5.1m 10y
Please do like this,

        string pattern = @"/^\s*(&nbsp;)+/gi",/(&nbsp;|<br[^>]*>)+\s*$/gi";
        Regex rgx =
new Regex(pattern, RegexOptions.IgnoreCase);

http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex%28v=vs.110%29.aspx


Kindest Regards
Sibeesh
http://sibeeshpassion.com/