Ahhh the old RegEx game. Who wants to play?
There are 2 (probably more) ways to handle the goal of capturing the last 2 characters of a string. You can either use Results.RegEx (preferred) or Results.RegExReplace.
(edited this, got it backwards the first time!)With Results.RegEx you end up with your 2 chars in {Match.1}
With Results.RegExReplace you end up with your 2 chars in {LastResult}
Here is the xml showing both ways.
Some additional notes:
1 - I am using Results.SetLastResult at the beginning to simulate whatever you would be getting back form your device
2 - While I am at it, this seems like a good way to show how we can use a simple Python action to convert Hex values (from 00 to FF) into a percentage. If you want to do this you will need to first make sure that the Python plugin is enabled.
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 1.9.1.8-->
<commandGroup open="True" name="last 2 chars" enabled="True" prefix="" priority="0" requiredProcess="" description="">
<command id="277" name="last2chars using RegExReplace" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
<action>
<cmdType>Results.SetLastResult</cmdType>
<params>
<param>thang thank doodad stuff B109F</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>Results.RegEx</cmdType>
<params>
<param>(..)$</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>PY.ExecString</cmdType>
<params>
<param>result = round(0x{Match.1}/2.55,0)</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>OSD.ShowText</cmdType>
<params>
<param>Level is: {LastResult} percent.</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
</command>
<command id="290" name="last2chars using RegExReplace" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
<action>
<cmdType>Results.SetLastResult</cmdType>
<params>
<param>thang thank doodad stuff B109F</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>Results.RegExReplace</cmdType>
<params>
<param>.*(..)$</param>
<param>$1</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>PY.ExecString</cmdType>
<params>
<param>result = round(0x{LastResult}/2.55,0)</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>OSD.ShowText</cmdType>
<params>
<param>Level is: {LastResult} percent.</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
</command>
</commandGroup>
http://voxcommando.com/mediawiki/index.php?title=XML_on_the_forum