#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "\[weight][^\n]*(?:\n(?!$|\n)[^\n]*)*"
Local $sString = "#########################" & @CRLF & _
"### MOSES CONFIG FILE ###" & @CRLF & _
"#########################" & @CRLF & _
"" & @CRLF & _
"# input factors " & @CRLF & _
"[input-factors]" & @CRLF & _
"0" & @CRLF & _
"" & @CRLF & _
"# mapping steps" & @CRLF & _
"[mapping]" & @CRLF & _
"0 T 0" & @CRLF & _
"" & @CRLF & _
"[distortion-limit]" & @CRLF & _
"6" & @CRLF & _
"" & @CRLF & _
"# feature functions" & @CRLF & _
"[feature]" & @CRLF & _
"UnknownWordPenalty" & @CRLF & _
"WordPenalty" & @CRLF & _
"PhrasePenalty" & @CRLF & _
"PhraseDictionaryMemory name=TranslationModel0 num-features=4 path=/home /gillin/jojomert/phrase-jojo/work.src-ref/training/model/phrase-table.gz input-factor=0 output-factor=0" & @CRLF & _
"LexicalReordering name=LexicalReordering0 num-features=6 type=wbe-msd-bidirectional-fe-allff input-factor=0 output-factor=0 path=/home/gillin/jojomert/phrase-jojo/work.src-ref/training/model/reordering-table.wbe-msd-bidirectional-fe.gz" & @CRLF & _
"Distortion" & @CRLF & _
"KENLM lazyken=0 name=LM0 factor=0 path=/home/gillin/jojomert/ru.kenlm order=5" & @CRLF & _
"" & @CRLF & _
"# dense weights for feature functions" & @CRLF & _
"[weight]" & @CRLF & _
"UnknownWordPenalty0= 1" & @CRLF & _
"WordPenalty0= -1" & @CRLF & _
"PhrasePenalty0= 0.2" & @CRLF & _
"TranslationModel0= 0.2 0.2 0.2 0.2" & @CRLF & _
"LexicalReordering0= 0.3 0.3 0.3 0.3 0.3 0.3" & @CRLF & _
"Distortion0= 0.3" & @CRLF & _
"LM0= 0.5"
Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYFULLMATCH)
; 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