#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?:(?:[一-龥,、‘’《》]|(.*?)|\(.*?\))+[,。;?!])"
Local $sString = "" & @CRLF & _
"# 2、鱼我所欲也(《孟子·告子上》)" & @CRLF & _
" 鱼,我所欲也,熊掌,亦我所欲也,二者不可得兼,舍鱼而取熊掌者也。生,亦我所欲也,义,亦我所欲也,二者不可得兼,舍生而取义者也。生亦我所欲,所欲有甚于生者,故不为苟得也。死亦我所恶,所恶有甚于死者,故患有所不辟也。如使人之所欲莫甚于生,则凡可以得生者何不用也。使人之所恶莫甚于死者,则凡可以辟患者何不为也!由是则生而有不用也,由是则可以辟患而有不为也。是故所欲有甚于生者,所恶有甚于死者。非独贤者有是心也,人皆有之,贤者能勿丧耳。" & @CRLF & _
" 一箪食,一豆羹,得之则生,弗得则死。呼尔而与之,行道之人弗受;蹴尔而与之,乞人不屑也。" & @CRLF & _
" 万钟则不辩礼义而受之,万钟于我何加焉!为宫室之美,妻妾之奉,所识穷乏者得我与?乡为身死而不受,今为宫室之美为之;乡为身死而不受,今为妻妾之奉为之;乡为身死而不受,今为所识穷乏者得我而为之;是亦不可以已乎?此之谓失其本心。" & @CRLF & _
""
Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYGLOBALFULLMATCH)
Local $aFullArray[0]
For $i = 0 To UBound($aArray) -1
_ArrayConcatenate($aFullArray, $aArray[$i])
Next
$aArray = $aFullArray
; Present the entire match result
_ArrayDisplay($aArray, "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 AutoIt, please visit: https://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm