#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "((?<=href="\/)(.+(?=\.(doc|pdf)))|(?<=src=")((http|https).+(?=\/(v2|userfiles)\/)))"
Local $sString = "href="http://www.mataderomadrid.org/v2/userfiles/WEB_ESP_LINEAS%20DE%20PROGRAMACION%20DE%20MATADERO_29_01_19.pdf"" & @CRLF & _
"href="/userfiles/WEB_ESP_LINEAS%20DE%20PROGRAMACION%20DE%20MATADERO_29_01_19.pdf"" & @CRLF & _
"href="/userfiles/WEB_ESP_LINEAS%20DE%20PROGRAMACION%20DE%20MATADERO_29_01_19.doc"" & @CRLF & _
"href="/this/is/valid"" & @CRLF & _
"href="/this/another/valid/link.html"" & @CRLF & _
"src="/userfiles/image.png"" & @CRLF & _
"src="/userfiles/image.jpeg"" & @CRLF & _
"src="/userfiles/image"" & @CRLF & _
"src="http://www.mataderomadrid.org/v2/xxx.jpeg"" & @CRLF & _
"src="http://www.mataderomadrid.org/userfiles/xxx.jpeg"" & @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