#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)(?<!(?:\/\/|\*).*)((?:export|import)[\s\w*,{}]*(?=\sfrom)|export\b\s*(?:[*{]|\w\s?.+)|await import|import\.meta\.(?:env(?:\.\w+)?|resolve|url))"
Local $sString = "import * as foo from 'foo'" & @CRLF & _
"import { foo } from 'foo'" & @CRLF & _
"import {" & @CRLF & _
" foo," & @CRLF & _
" bar" & @CRLF & _
"} from 'foo'" & @CRLF & _
"import.meta.env" & @CRLF & _
"import.meta.env.foo" & @CRLF & _
"import.meta.url" & @CRLF & _
"import.meta.resolve" & @CRLF & _
"export * from './foo' " & @CRLF & _
"export { default } from './foo'" & @CRLF & _
"export {" & @CRLF & _
" foo," & @CRLF & _
" bar" & @CRLF & _
"} from 'foo'" & @CRLF & _
"export async function" & @CRLF & _
"" & @CRLF & _
"// export async function" & @CRLF & _
"" & @CRLF & _
"/**" & @CRLF & _
" *" & @CRLF & _
" * @example" & @CRLF & _
" * export default foo = 123" & @CRLF & _
" *" & @CRLF & _
" */" & @CRLF & _
" " & @CRLF & _
"await import" & @CRLF & _
" " & @CRLF & _
"export default foo" & @CRLF & _
"export default function foo" & @CRLF & _
"export default () => {" & @CRLF & _
"}" & @CRLF & _
"export class" & @CRLF & _
"export type"
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