-4

I need to know uptime of the modem. I've examined the html; first the day counter should be extracted and then the timespan. I know there is Html Agility Pack but I want to keep it simple.

This is the html source snippet from the modem:

<tr><td><b><span id='SystemUpTime'>System Up Time</span></b></td><td>0 <span id='RgSwInfodays'>days</span> 00h:02m:09s</td></tr>

What would be the regex codes to extract day and then time?

Sayse
  • 42,633
  • 14
  • 77
  • 146
Nime Cloud
  • 6,162
  • 14
  • 43
  • 75
  • [Don't use regex to parse html](http://stackoverflow.com/questions/590747/using-regular-expressions-to-parse-html-why-not) – Sayse Jun 17 '15 at 06:26

1 Answers1

1

the timestamp looks unique to me so i would use its pattern

time

[0-9]{2}h:[0-9]{2}m:[0-9]{2}s

day

if the day is always folloed by <span id='RgSwInfodays'> and has a length 1-3

[0-9]{1,3}(?= <span id='RgSwInfodays'>)
fubo
  • 44,811
  • 17
  • 103
  • 137