Do the Following
PHP Code:
$m_body = <m_body of character>;
$m_bodySubstr = explode("\_1",$m_body)
So, $m_bodySubstr will be an array which stores the substrings in the m_body. Hence $m_bodySubstr[5] will contain the string for Inventory. It would be
Code:
INVEN=9586;32;45386404;0
We need to remove the "INVEN=" string from the above code.
PHP Code:
$InvenItems=substring($m_bodySubstr[5],5);
$InvenItemsArray = explode(";",$InvenItems);
$InvenItemsArray will have all the item codes and other attibutes. So $InvenItemsArray[0] is the ItemID, $InvenItemsArray[1] is the Attribute and $InvenItemsArray[2] is the UniqueID and every 3rd element is the Item Code of another item.
In this way you could check for RB requirement. And if you need to remove any item, empty the Array index which is carrying the value. Write a for loop to construct the array back to the string for both the arrays. You will end up getting a m_body field as a string with the required changes done.