#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?misU)<([^<\/>]*)([^<\/>]*)>([\s]*?|(?R))<\/\1>"
Local $sString = " <table>" & @CRLF & _
" <tr>" & @CRLF & _
" <th>Nome da Opção</th>" & @CRLF & _
" <th class="boxToolTip" title="O símbolo para PETRD197 Ex:19,7 é PETRD197">Código da Opção</th>" & @CRLF & _
" <th class="boxToolTip" title="PETRD197 Ex:19,7 está listado(a) no mercado Bovespa">Bolsa de Valores</th>" & @CRLF & _
" <th class="boxToolTip" title="">Tipo de Ativo</th>" & @CRLF & _
" " & @CRLF & _
" <th class="boxToolTip" title="O código ISIN para PETRD197 Ex:19,7">Código ISIN do Ativo</th>" & @CRLF & _
" " & @CRLF & _
" " & @CRLF & _
" " & @CRLF & _
" <th class="ColumnLast">Descrição da Opção</th>" & @CRLF & _
" " & @CRLF & _
" </tr>" & @CRLF & _
" <tr class="odd">" & @CRLF & _
" <td align="center"><b>PETRD197 Ex:19,7 20/04/2020</b></td>" & @CRLF & _
" <td align="center"><b>PETRD197</b></td>" & @CRLF & _
" <td align="center"><b><a href='/bolsa-de-valores/bovespa' title='Bovespa'>Bovespa</a></b></td>" & @CRLF & _
" <td align="center"><span id="quoteElementPiece5" class="">Opção</span></td>" & @CRLF & _
" " & @CRLF & _
" <td align="center"><span id="quoteElementPiece6" class="">BRPETR4D0UU5</span></td>" & @CRLF & _
" " & @CRLF & _
" " & @CRLF & _
" " & @CRLF & _
" <td align="center">Opção de Compra Ex:19,7 Vencimento: Abril</td>" & @CRLF & _
" " & @CRLF & _
" </tr>" & @CRLF & _
" </table>" & @CRLF & _
"</div>" & @CRLF & _
"" & @CRLF & _
" <div class="TableElement">" & @CRLF & _
" <table>" & @CRLF & _
" <tr>" & @CRLF & _
" <th>Preço de Exercício (Strike)</th>" & @CRLF & _
" <th>Vencimento do Contrato</th>" & @CRLF & _
" <th>Dias até Vencimento</th>" & @CRLF & _
" <th>Tipo de Negócio</th>" & @CRLF & _
" <th>Estilo de Opção</th>" & @CRLF & _
" <th>Classif.</th>" & @CRLF & _
" <th>Valor Intrínsico da Opção</th>" & @CRLF & _
" <th class="ColumnLast">Valor Extrínsico da Opção</th>" & @CRLF & _
" </tr>" & @CRLF & _
" <tr class="odd">" & @CRLF & _
" <td align="center">19,70</td>" & @CRLF & _
" <td align="center">20/04/2020</td>" & @CRLF & _
" <td align="center">3 dias</td>" & @CRLF & _
" <td align="center">Call</td>" & @CRLF & _
" <td align="center">Americano</td>" & @CRLF & _
" <td align="center">OTM</td>" & @CRLF & _
" <td align="center">-3,59</td>" & @CRLF & _
" <td align="center">3,60</td>" & @CRLF & _
" </tr>" & @CRLF & _
" </table>" & @CRLF & _
" </div>" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"<div class="TableElement">" & @CRLF & _
" <table>" & @CRLF & _
" <tr>" & @CRLF & _
" <th class="boxToolTip" title="O preço para PETRD197 Ex:19,7 está em alta ou baixa?"> </th>" & @CRLF & _
" <th class="boxToolTip" title="Mudança no preço de PETRD197 Ex:19,7">Variação do Dia (p)</th>" & @CRLF & _
" <th class="boxToolTip" title="Variação no preço de PETRD197 Ex:19,7">Variação do Dia %</th>" & @CRLF & _
" <th class="boxToolTip" title="Preço atual de PETRD197 Ex:19,7">Último Preço</th>" & @CRLF & _
" <th class="boxToolTip" title="Menor preço para as ações de PETRD197 Ex:19,7 hoje">Preço Mínimo</th>" & @CRLF & _
" <th class="boxToolTip" title="Maior preço para as ações de PETRD197 Ex:19,7 hoje">Preço Máximo</th>" & @CRLF & _
" <th class="boxToolTip" title="Preço de abertura para PETRD197 Ex:19,7 hoje">Preço de Abertura</th>" & @CRLF & _
" <th class="boxToolTip" title="Preco de fechamento de PETRD197 Ex:19,7 ontem">Preço de Fechamento</th>" & @CRLF & _
" <th class="boxToolTip" class="ColumnLast" title="Último negócio para PETRD197 Ex:19,7">Hora <img title='' alt='' class='quotePageRTupgradeLink' href='#quotePageRTupgradeContainer' id='cautionImageEnt' src='/common/images/icons/caution_sign.gif'/></th>" & @CRLF & _
" </tr>" & @CRLF & _
" <tr class="odd">" & @CRLF & _
" <td align="center" class="change_arrow_fa"><span id="quoteElementPiece7" class="PriceTextUnchanged"><span class="fa fa-circle PriceTextUnchanged fa-fw"></span></span></td>" & @CRLF & _
" <td align="center" class="change"><span id="quoteElementPiece8" class="PriceTextUnchanged">0,00</span></td>" & @CRLF & _
" <td align="center" class="chgpct"><span id="quoteElementPiece9" class="PriceTextUnchanged">0,0%</span></td>" & @CRLF & _
" <td align="center" class="current_price"><span id="quoteElementPiece10" class="PriceTextUnchanged">0,01</span></td>" & @CRLF & _
" <td align="center"><span id="quoteElementPiece11" class="">0,01</span></td>" & @CRLF & _
" <td align="center"><span id="quoteElementPiece12" class="">0,01</span></td>" & @CRLF & _
" <td align="center"><span id="quoteElementPiece13" class="">0,01</span></td>" & @CRLF & _
" <td align="center"><span id="quoteElementPiece14" class="">0,01</span></td>" & @CRLF & _
" <td align="center"><span id="quoteElementPiece15" class="">10:00:00</span></td>" & @CRLF & _
" </tr>" & @CRLF & _
" </table>" & @CRLF & _
"</div>" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
" " & @CRLF & _
"" & @CRLF & _
" " & @CRLF & _
" <div class="TableElement">" & @CRLF & _
" <table>" & @CRLF & _
" <tr>" & @CRLF & _
" <th class="boxToolTip" title="O número total de negócios que foram executados para PETRD197 durante o pregão mais recente.">Número de Negócios</th>" & @CRLF & _
" <th class="boxToolTip" title="Volume total negociado para PETRD197 Ex:19,7 hoje">Volume de Ações Negociadas</th>" & @CRLF & _
" " & @CRLF & _
" <th class="boxToolTip" title="">Preço Médio</th>" & @CRLF & _
" <th class="boxToolTip" title="O valor total financeiro para este ativo durante o pregão mais recente. Volume financeiro é um cálculo contínuo sobre todos os negócios do pregão. Para cada negócio no pregão você multiplica o preço pelo número de ativos negociados. Então some esse resultado para todos os negócios no pregão.">Volume Financeiro</th>" & @CRLF & _
" " & @CRLF & _
" <th class="boxToolTip" title="O volume médio diário durante os últimos 30 dias negociados.">Volume médio</th>" & @CRLF & _
" " & @CRLF & _
" <th class="boxToolTip" title="O valor mais baixo e mais alto que o ativo atingiu nas últimas 52 semanas">Últimas 52 Semanas</th>" & @CRLF & _
" " & @CRLF & _
" </tr>" & @CRLF & _
" <tr class="odd">" & @CRLF & _
" <td align="center"><span id="quoteElementPiece16" class="">7</span></td>" & @CRLF & _
" <td align="center"><span id="quoteElementPiece17" class="">22.000</span></td>" & @CRLF & _
" " & @CRLF & _
" <td align="center"><span id="quoteElementPiece18" class="PriceTextUnchanged"> 0,01</span></td>" & @CRLF & _
" <td align="center"></span><span id="quoteElementPiece19" class=""> 220</span></td>" & @CRLF & _
" " & @CRLF & _
" <td align="center">-</td>" & @CRLF & _
" " & @CRLF & _
" <td align="center">0,00 - 0,00</td>" & @CRLF & _
" " & @CRLF & _
"" & @CRLF & _
" </tr>" & @CRLF & _
" </table>" & @CRLF & _
" </div>" & @CRLF & _
" " & @CRLF & _
"" & @CRLF & _
" " & @CRLF & _
" <div class="TableElement">" & @CRLF & _
" <table>" & @CRLF & _
" <tr>" & @CRLF & _
" <th class="boxToolTip" title="O horário do último negócio realizado">Último Negócio</th>" & @CRLF & _
" <th>Tipo de Negócio</th>" & @CRLF & _
" <th>Quantidade de Ações Negociadas</th>" & @CRLF & _
" <th class="boxToolTip" title="O último preço negociado para PETRD197 Ex:19,7 (PETRD197).">Preço Negociado</th>" & @CRLF & _
" <th class="ColumnLast">Moeda</th>" & @CRLF & _
" </tr>" & @CRLF & _
" <tr class="odd">" & @CRLF & _
" <td align="center"><span id="quoteElementPiece20" class="">10:33:55</span></td>" & @CRLF & _
" <td align="center"><span id="quoteElementPiece21" class=""></span></td>" & @CRLF & _
" <td align="center"><span id="quoteElementPiece22" class="">100</span></td>" & @CRLF & _
" <td align="center" onclick="javascript:location.href='/bolsa-de-valores/bovespa/petrd197-ex-19-7-PETRD197/negocios'" style="cursor:pointer;text-decoration:underline;color:black;"><span id="quoteElementPiece23" class="trdprice current_price PriceTextUnchanged"> 0,01</span></td>" & @CRLF & _
" <td align="center"><span id="quoteElementPiece24" class="">BRL</span></td>" & @CRLF & _
" </tr>" & @CRLF & _
"" & @CRLF & _
" </table>" & @CRLF & _
" </div>" & @CRLF & _
" " & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"<div class="TableElement">" & @CRLF & _
" <table>" & @CRLF & _
" <tr>" & @CRLF & _
" <th>Setor da Empresa</th>" & @CRLF & _
" </tr>" & @CRLF & _
" <tr class="odd">" & @CRLF & _
" <td align="center">" & @CRLF & _
" <a href="/mundo/brasil/setores/mineracao-extracao-petroleo-gas/extracao-petroleo-gas">Petróleo, Gás e Biocombustíveis / Petróleo, Gás e Biocombustíveis / Exploração e/ou Refino</a>" & @CRLF & _
" </td>" & @CRLF & _
" </tr>" & @CRLF & _
" </table>" & @CRLF & _
"</div>" & @CRLF & _
"" & @CRLF & _
"<div class="TableElement">" & @CRLF & _
" <table><tr><th>Anotações</th></tr><tr class='odd'><td><a href='#' role='login'>Clique aqui para escrever uma anotação sobre esse ativo.</a></td></tr></table>"
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