#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)^(\d+,\s*'[^',]*).*(',[^,\n]*)$"
Local $sString = "119, 'Youth Campus,Janakpur', Janakpur " & @CRLF & _
"978, 'Yog Kumar Janta Campus, Balwa-3', Mahottari " & @CRLF & _
"806, 'Yerawati Aadarsha Multiple Campus, Lalmatiya Deukhuri, Dang', Dang " & @CRLF & _
"613, 'Yasok Campus, Yasok, Panchther', Panchthar " & @CRLF & _
"458, 'Yagyodaya Dudhnath Tharu Multiple Campus,Suddhodhan-3,Ramawapur', Rupandehi " & @CRLF & _
"1008, 'Yagnyabhumi Multiple Campus, Dharapani', Dhanusha " & @CRLF & _
"546, 'Xavier International College, Kamalpokhari,kath', Kathmandu " & @CRLF & _
"362, 'Xavier Academy Science College, Lazimpat, Kathmandu', Kathmandu "
Local $sSubst = "\1\2"
Local $sResult = StringRegExpReplace($sString, $sRegex, $sSubst)
MsgBox($MB_SYSTEMMODAL, "Result", $sResult)
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 AutoIt, please visit: https://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm