REGEX expression for a multiline string

I’m trying to extract a number from the third row of a command issued by a raspberry

iostat -c
Linux 4.1.18-v7+ (raspberrypi) 16/07/16 armv7l(4 CPU)

avg-cpu: %user %nice %system %iowait %steal %idle
10.50 0.00 0.44 0.18 0.00 88.89

I’m absolutely not a REGEX expert but I was expecting the following line
str=transform(“REGEX”,(.*)",command)
to place in the str string only the first line ( the dot matches any character except newline) but it actually gives all the lines.

I was thinking that
str=transform(“REGEX”(?:.){3},(.)",command)
would have given the 4th line, but it does not work.

Is this a limitation of the implementation of REGEX in openhab?
Should I use a JavaScript transformation rule instead?

Thanks for your help,
LionHe

I did’nt use regex in rules yet. First Thing to know is, the result of the transformation is always the first capturing group. You need to identify the row, which is not that easy, at least I don’t know how :wink:
I would suggest to write a little script at Pi side which provides the correct line.

Thanks. I gave up with REGEX and actually used a JavaScript piece of code using the split method, closely following an example in the wiki.
LionHe