#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)class [A-Za-z_$]*\s*\{"
Local $sString = "class Entity" & @CRLF & _
"{" & @CRLF & _
" constructor(game,imageURL)" & @CRLF & _
" {" & @CRLF & _
" this.game = game;" & @CRLF & _
" this.sprite = new Sprite(this.game.c,imageURL);" & @CRLF & _
" " & @CRLF & _
" }" & @CRLF & _
" " & @CRLF & _
" " & @CRLF & _
" draw(depth,offset,textureSize,textureCoordinates,offsetX=0)" & @CRLF & _
" {" & @CRLF & _
" let scaleFactors = {" & @CRLF & _
" 1:1," & @CRLF & _
" 2:0.65," & @CRLF & _
" 3:0.45" & @CRLF & _
" };" & @CRLF & _
" let scaleFactor = scaleFactors[depth];" & @CRLF & _
" " & @CRLF & _
" let x = Math.floor(offset.x + textureCoordinates[0] + (textureSize[0] / 2) - (this.sprite.image.width * scaleFactor / 2));" & @CRLF & _
" let y = Math.floor(offset.y + textureCoordinates[1] + (textureSize[1] / 2) - (this.sprite.image.height * scaleFactor) + 6 * scaleFactor);" & @CRLF & _
" " & @CRLF & _
" x = x + offsetX * scaleFactor;" & @CRLF & _
" " & @CRLF & _
" let width = Math.floor(this.sprite.image.width * scaleFactor);" & @CRLF & _
" let height = Math.floor(this.sprite.image.height * scaleFactor);" & @CRLF & _
" " & @CRLF & _
" let entityFades = {" & @CRLF & _
" 1:1," & @CRLF & _
" 2:0.5," & @CRLF & _
" 3:0.1" & @CRLF & _
" }" & @CRLF & _
" let filter = '';" & @CRLF & _
" if(this.game.level.entities.fadeType === 'darken')" & @CRLF & _
" {" & @CRLF & _
" filter += 'brightness('+entityFades[depth]+')';" & @CRLF & _
" }" & @CRLF & _
" " & @CRLF & _
" this.sprite.draw(" & @CRLF & _
" x," & @CRLF & _
" y," & @CRLF & _
" width," & @CRLF & _
" height," & @CRLF & _
" 0," & @CRLF & _
" 0," & @CRLF & _
" this.sprite.image.width," & @CRLF & _
" this.sprite.image.height," & @CRLF & _
" filter" & @CRLF & _
" );" & @CRLF & _
" }" & @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