$re = '/MDS\s*\d+\s+([^\r\n\s]+)[^\r\n]*\s+Chassis/';
$str = '1469481745 1 Host/Cisco/show_ver=Cisco Nexus Operating System (NX-OS) Software\\r\\nTAC support: http://www.cisco.com/tac\\r\\nCopyright (C) 2002-2015, Cisco and/or its affiliates.\\r\\nAll rights reserved.\\r\\nThe copyrights to certain works contained in this software are\\r\\nowned by other third parties and used and distributed under their own\\r\\nlicenses, such as open source. This software is provided "as is," and unless\\r\\notherwise stated, there is no warranty, express or implied, including but not\\r\\nlimited to warranties of merchantability and fitness for a particular purpose.\\r\\nCertain components of this software are licensed under\\r\\nthe GNU General Public License (GPL) version 2.0 or \\r\\nGNU General Public License (GPL) version 3.0 or the GNU\\r\\nLesser General Public License (LGPL) Version 2.1 or \\r\\nLesser General Public License (LGPL) Version 2.0. \\r\\nA copy of each such license is available at\\r\\nhttp://www.opensource.org/licenses/gpl-2.0.php and\\r\\nhttp://opensource.org/licenses/gpl-3.0.html and\\r\\nhttp://www.opensource.org/licenses/lgpl-2.1.php and\\r\\nhttp://www.gnu.org/licenses/old-licenses/library.txt.\\r\\n\\r\\nSoftware\\r\\n BIOS: version 07.34\\r\\n NXOS: version 7.0(3)I2(2a)\\r\\n--More--\\r BIOS compile time: 08/11/2015\\r\\n NXOS image file is: bootflash:///nxos.7.0.3.I2.2a.bin\\r\\n NXOS compile time: 12/14/2015 4:00:00 [12/14/2015 12:23:53]\\r\\n\\r\\n\\r\\nHardware\\r\\n cisco Nexus9000 C9332PQ chassis \\r\\n Intel(R) Core(TM) i3- CPU @ 2.50GHz with 16401956 kB of memory.\\r\\n Processor Board ID SAL183606N7\\r\\n\\r\\n Device name: ITC-GCC01-SP01\\r\\n bootflash: 7906304 kB\\r\\nKernel uptime is 0 day(s), 2 hour(s), 51 minute(s), 10 second(s)\\r\\n\\r\\nLast reset \\r\\n Reason: Unknown\\r\\n System version: 7.0(3)I2(2a)\\r\\n Service: \\r\\n\\r\\nplugin\\r\\n Core Plugin, Ethernet Plugin\\r\\n\\r\\nActive Package(s):\\r\\n--More--\\r nxos.CSCuy36553_TOR-1.0.0-7.0.3.I2.2a.lib32_n9000\\r\\n\\r';
$subst = "";
$result = preg_replace($re, $subst, $str, 1);
echo "The result of the substitution is ".$result;
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