Hi there,

May be some regex gurus can help me out. Being aware that regex's are tricky but not seeing another alternative in this particular case.

Trying to extract MOSLQ field from $rb.

$var(moslq) = $(rb{re.subst,/.*MOSLQ=([0-9].[0-9])\s+MOSCQ=([0-9].[0-9]).*/\1/s});

Above regex works fine IF body contains a single matching line. However, if there's 2 lines as in the below example - it return $var(moslq)=0.0, the last found value.

I need only LocalMetrics values, so I tried this regex which works fine in regex101.com with flag 'multi-line' and without flag 'global', but doesn't work in Kamailio.
$var(moslq) = $(rb{re.subst,/.*MOSLQ=([0-9].[0-9])\s+MOSCQ=([0-9].[0-9])[\nRemoteMetrics]?.*/\1/s});

Assuming $rb is as follows:
VQSessionReport
LocalMetrics:
Timestamps:START=2018-10-29T15:04:38Z STOP=2018-10-29T15:06:13Z
QualityEst:EXTRI=127 MOSLQ=4.2 MOSCQ=4.4
RemoteMetrics:
Timestamps:START=2018-10-29T15:04:38Z STOP=2018-10-29T15:06:13Z
QualityEst:RCQ=0 EXTRI=0 MOSLQ=0.0 MOSCQ=0.0

Thanks in advance.