0

I want to replace the following pattern in an html file

 <BR>1696.54</TD>

to

<TD>1696.54</TD>

I am using the RegEx.Replace code

 result = Regex.Replace(html, "<BR>\d</TD>", "<TD>$1</TD>")

but I am doing something incorrectly as nothing happens.

Any help would be appreciated..

PiE
  • 335
  • 1
  • 7
  • 24

1 Answers1

0

You need capture a group using parentheses and change :

`\d`

to

`\d*\.\d*` 

try this :

result = Regex.Replace(html, "<BR>(\d*\.\d*)</TD>", "<TD>$1</TD>")
Indent
  • 4,675
  • 1
  • 19
  • 35