$re = '/Product ID\s*:\s*(?<PRODUCTID>\w+)\s*Quantity\s*:\s*(?<QUANTITY>\w+)\s*Item\s*:\s*(?<ITEM>\w+)[\s\S]*?NEXT\s*ACTIONS\s*(?<NEXTACTIONS>.*)/m';
$str = '-----------------------------------------------------------------------------
Product ID : TXSKJI1123321
Quantity : 19
Item : Jeans
-----------------------------------------------------------------------------
NEXT ACTIONS
IF Stock less than 10
Then increase stock for TXSKJI1123321 up to 100 units
Else
No action needed
-----------------------------------------------------------------------------
Product ID : AKSP2790173332
Quantity : 7
Item : Shirts
-----------------------------------------------------------------------------
NEXT ACTIONS
Increase stock for AKSP2790173332 up to 50 units
-----------------------------------------------------------------------------
Product ID: AKSP27901733789
Quantity : 2
Item : Vest
-----------------------------------------------------------------------------
NEXT ACTIONS
Increase stock for AKSP27901733789 up to 15 units';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php