0

I have a problem with regex with Javascript. My issue is the following : This is my page

<ac:structured-macro ac:macro-id="4ee33cb1-4899-4e4e-8b42-2b04143baaf1" ac:name="table-chart" ac:schema-version="1">
  <ac:parameter ac:name="barColoringType">mono</ac:parameter>
  <ac:parameter ac:name="innerlabels">Percentage</ac:parameter>
  <ac:parameter ac:name="datepattern">d M yy</ac:parameter>
  <ac:parameter ac:name="id">1667468038889_3307</ac:parameter>
  <ac:parameter ac:name="isNew">true</ac:parameter>
  <ac:parameter ac:name="worklog">365|5|8|y w d h m|y w d h m</ac:parameter>
  <ac:parameter ac:name="formatVersion">3</ac:parameter>
  <ac:parameter ac:name="version">3</ac:parameter>
  <ac:parameter ac:name="colors">#8eb021,#d04437,#3572b0,#f6c342,#654982,#f691b2,#2484c1,#65a620,#7b6888,#d8d23a,#e98125,#6ada6a,#0c6197,#e4a14b,#8cc3e9,#a3acb2,#69a6f9,#cc1010,#31383b</ac:parameter>
  <ac:rich-text-body>
    <p>
      <ac:structured-macro ac:macro-id="a9fa198f-d1f2-412a-805c-06be93dc96d0" ac:name="jira" ac:schema-version="1">
        <ac:parameter ac:name="server">Jira Atlassian Factory</ac:parameter>
        <ac:parameter ac:name="columnIds">issuekey,summary,issuetype,created,updated,duedate,assignee,reporter,priority,status,resolution</ac:parameter>
        <ac:parameter ac:name="columns">key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution</ac:parameter>
        <ac:parameter ac:name="maximumIssues">20</ac:parameter>
        <ac:parameter ac:name="jqlQuery">project=DEMO </ac:parameter>
        <ac:parameter ac:name="serverId">64109c93-26d2-3749-a557-51c4124dd651</ac:parameter>
      </ac:structured-macro>
    </p>
  </ac:rich-text-body>
</ac:structured-macro>

and now my regex:

(<ac:structured-macro)[^>\]]*?(ac:name="table-chart")(.|\n)*?(<\/ac:structured-macro>)

Only my problem is that with this regex, it stops at the first closing tag </ac:structured-macro> (4th line from the end) enter image description here while I want my regex to also take into account the last tag , or the last line to check if my body takes into account two macros. Do you have any idea how to do it in JS? thanks in advance

hjpotter92
  • 78,589
  • 36
  • 144
  • 183
Benni
  • 1
  • 1

0 Answers0