$re = '/^(\d+,\s*\'[^\',]*).*(\',[^,\n]*)$/m';
$str = '119, \'Youth Campus,Janakpur\', Janakpur
978, \'Yog Kumar Janta Campus, Balwa-3\', Mahottari
806, \'Yerawati Aadarsha Multiple Campus, Lalmatiya Deukhuri, Dang\', Dang
613, \'Yasok Campus, Yasok, Panchther\', Panchthar
458, \'Yagyodaya Dudhnath Tharu Multiple Campus,Suddhodhan-3,Ramawapur\', Rupandehi
1008, \'Yagnyabhumi Multiple Campus, Dharapani\', Dhanusha
546, \'Xavier International College, Kamalpokhari,kath\', Kathmandu
362, \'Xavier Academy Science College, Lazimpat, Kathmandu\', Kathmandu ';
$subst = "\1\2";
$result = preg_replace($re, $subst, $str);
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