#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)(?:(?:http|https):\/\/)?(?:www.|m.)?facebook.com\/(?!home.php)(?:(?:\w)*#!\/)?(?:pages\/)?(?:[?\w\-]*\/)?(?:profile.php\?id=(?=\d.*))?([\w\.-]+)"
Local $sString = "http://www.facebook.com/jquery2dotnet" & @CRLF & _
"http://www.facebook.com/some.user" & @CRLF & _
"https://www.facebook.com/#!/my_page_id" & @CRLF & _
"http://www.facebook.com/pages/test" & @CRLF & _
"http://www.facebook.com/pages/test/123" & @CRLF & _
"https://www.facebook.com/#!/page_with_1_number" & @CRLF & _
"http://www.facebook.com/bounce_page#!/pages/test-Url/12345" & @CRLF & _
"https://www.facebook.com/bounce_page#!/my_page_id?v=app_1123325" & @CRLF & _
"https://www.facebook.com/notes/hyperarts-web-design" & @CRLF & _
"http://www.facebook.com/test.username" & @CRLF & _
"https://www.fb.me/jquery2dotnet" & @CRLF & _
"http://www.facebook.com/" & @CRLF & _
"http://m.facebook.com/home.php" & @CRLF & _
"http://m.facebook.com/test.username" & @CRLF & _
"https://mbasic.facebook.com/home.php?_rdr"
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