I used he following:
@monitorCall getOff 'M851 .Z(-?\d.?\d)' 5000 hitOff missOff
M851
@func hitOff Z
@set global.probeOffset {{local.Z}}
@call display
@endfunc
@func missOff
@Info "Miss"
@endfunc
M851 returns
M851 X-40.00 Y-6.00 Z-1.39 ; (mm)
global.probeOffset then contains -1 instead of -1.39
The only way I can get the full value is to use
@monitorCall getOff 'M851 .*Z(-?....)' 5000 hitOff missOff
but if the Z value is -12.23, I would miss the last 3. Luckily the value should never be 2 digits before the decimal so I'm okay for now. But there seems to be an error in the Regular Expression processing. Or is it me?
I also tried
@monitorCall getOff 'M851 .Z(\S)' 5000 hitOff missOff
which should give all characters up to the next white space character. But that also only retuns -1