Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
ECMAScript (JavaScript)

/
^\s*\S+\s+up\s+(?<uptime>(?:\S+\s+day[s]?,\s+\d+:\d+|\S+\s+min)|\d+:\d+)
/
gm

Description

Text: 16:37:50 up 18 days, 19:59, load average: 0.23, 0.26, 0.29 11:12:08 up 899 days, 20:35, 2 users, load average: 0.28, 0.29, 0.25 15:19:17 up 22:45, load average: 0.18, 0.31, 0.36 11:11:11 up 12:55, 2 users, load averages: 0.00, 0.01, 0.06 11:11:11 up 55 min, 2 users, load averages: 0.00, 0.01, 0.06

Match: 18 days, 19:59 899 days, 20:35 22:45 12:55 55 min

Submitted by Feruz Ibadullaev - 2 years ago (Last modified a year ago)