#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "<span id="organization">(?<company_name>[^<]+)<\/span><\/p>\n\s*(?<designation>[^\n]+)\n\s*<p>(?<date>[^\n]+)"
Local $sString = "<h5>Work Experience</h5>" & @CRLF & _
" <p><span id="organization">Company Name 1</span></p>" & @CRLF & _
" Designation 1" & @CRLF & _
" <p>Date 1" & @CRLF & _
" </p>" & @CRLF & _
" <ul>" & @CRLF & _
" <li>Some text 1</li>" & @CRLF & _
" </ul>" & @CRLF & _
" <p><span id="organization">Company Name 2</span></p>" & @CRLF & _
" Designation 2" & @CRLF & _
" <p>Date 2" & @CRLF & _
" </p>" & @CRLF & _
" <ul>" & @CRLF & _
" <li>Some text 2</li>" & @CRLF & _
" </ul>" & @CRLF & _
" <p><span id="organization">Company Name 3</span></p>" & @CRLF & _
" Designation 3" & @CRLF & _
" <p>Date 3" & @CRLF & _
" </p>" & @CRLF & _
" <ul>" & @CRLF & _
" <li>Some text 3</li>" & @CRLF & _
" </ul></div>"
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