#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?mis)^const labels(.*)const config = {type: 'line',data: data,options: {}};"
Local $sString = "" & @CRLF & _
"<script src="/js/theme.min-1.1.js"></script><script>" & @CRLF & _
"const labels = [" & @CRLF & _
"'00:00','01:00','02:00','03:00','04:00','05:00','06:00','07:00','08:00','09:00','10:00','11:00','12:00','13:00','14:00','15:00','16:00','17:00','18:00','19:00','20:00','21:00','22:00','23:00','24:00',];" & @CRLF & _
"const data = {" & @CRLF & _
" labels: labels," & @CRLF & _
" datasets: [{" & @CRLF & _
" stepped:true," & @CRLF & _
" label: 'Idag'," & @CRLF & _
" backgroundColor: '#357DA7'," & @CRLF & _
" borderColor: '#357DA7'," & @CRLF & _
" data: [94.24,91.59,93.52,97.70,103.23,155.15,233.20,269.03,279.92,255.87,231.30,226.70,209.64,174.65,164.84,154.16,134.04,199.48,205.03,204.88,192.49,154.16,74.40,19.47,19.47]" & @CRLF & _
" }," & @CRLF & _
" {" & @CRLF & _
" label: 'Idag snitt'," & @CRLF & _
" backgroundColor: '#fff'," & @CRLF & _
" borderColor: '#357DA7'," & @CRLF & _
" borderDash: [5, 5]," & @CRLF & _
" data: [167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,]," & @CRLF & _
" pointRadius: 0," & @CRLF & _
" borderWidth: 2" & @CRLF & _
" }" & @CRLF & _
" ,{" & @CRLF & _
" stepped:true," & @CRLF & _
" label: 'Imorgon'," & @CRLF & _
" backgroundColor: '#dd4b39'," & @CRLF & _
" borderColor: '#dd4b39'," & @CRLF & _
" data: [10.28,9.82,6.15,5.10,11.91,13.78,80.03,205.79,215.04,214.14,211.85,205.64,204.86,165.63,166.62,196.70,200.63,207.10,211.79,211.80,208.24,207.02,113.90,47.63,47.63]" & @CRLF & _
" },{" & @CRLF & _
" label: 'Imorgon snitt'," & @CRLF & _
" backgroundColor: '#fff'," & @CRLF & _
" borderColor: '#dd4b39'," & @CRLF & _
" borderDash: [5, 5]," & @CRLF & _
" data: [138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,]," & @CRLF & _
" pointRadius: 0," & @CRLF & _
" borderWidth: 2" & @CRLF & _
" } ]" & @CRLF & _
"}; " & @CRLF & _
"const config = {type: 'line',data: data,options: {}};" & @CRLF & _
"var myChart = new Chart(document.getElementById('myChart'),config);" & @CRLF & _
"</script>"
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