Note that there are some explanatory texts on larger screens.

plurals
  1. PORegEx multiple-matches in VB6
    primarykey
    data
    text
    <p>I have a text to scan like this:</p> <pre class="lang-none prettyprint-override"><code> -- FIRST BLOCK Begin PRJFW_EDITM.TXT_EDITM TXT_CLIFOR Height = 300 Left = 2685 DBField = "CG44_CLIFOR" Caption = "Codice cliente fornitore" Object.Tag = "Codice cliente fornitore" MaxWidth = 8 End -- SECOND BLOCK Begin PRJFW_EDITM.TXT_EDITM TXT_CLIFOR Height = 300 Left = 2685 DBField = "CG44_CLIFOR" Caption = "Codice cliente fornitore" Object.Tag = "Codice cliente fornitore" MaxWidth = 6 End -- THIRD BLOCK Begin PRJFW_EDITM.TXT_EDITM TXT_CLIFOR Height = 300 Left = 2685 DBField = "CG16_ANAG" Caption = "Codice cliente fornitore" Object.Tag = "Codice cliente fornitore" MaxWidth = 6 End </code></pre> <p>I want to match only blocks where (<code>MaxWidth=6</code>). </p> <p>I'm doing some tests but something is wrong... for example using this RegEx expression:</p> <pre class="lang-none prettyprint-override"><code>(Begin[\s\S]+?(MaxWidth.*=)[\s\S]+?End) </code></pre> <p>I correctly match the tree blocks visible in my code above.</p> <p>Then if I try to modify the regEx for matching only the blocks with the value '6' for 'MaxWidth' property:</p> <pre class="lang-none prettyprint-override"><code>(Begin[\s\S]+?(MaxWidth.*= 6)[\s\S]+?End) </code></pre> <p>I correctly match only two blocks but the first one is wrong. First match:</p> <pre class="lang-none prettyprint-override"><code>Begin PRJFW_EDITM.TXT_EDITM TXT_CLIFOR Height = 300 Left = 2685 DBField = "CG44_CLIFOR" Caption = "Codice cliente fornitore" Object.Tag = "Codice cliente fornitore" MaxWidth = 8 End -- SECOND BLOCK Begin PRJFW_EDITM.TXT_EDITM TXT_CLIFOR Height = 300 Left = 2685 DBField = "CG44_CLIFOR" Caption = "Codice cliente fornitore" Object.Tag = "Codice cliente fornitore" MaxWidth = 6 End </code></pre> <p>It starts with the first 'Begin' and terminate with the correct property value in the second block. That's wrong.</p> <p>I want that the (<code>MaxWidth=6</code>) is matched inside each Begin...End block. Something like this (referring to my code above):</p> <p>Fist match:</p> <pre class="lang-none prettyprint-override"><code> Begin PRJFW_EDITM.TXT_EDITM TXT_CLIFOR Height = 300 Left = 2685 DBField = "CG44_CLIFOR" Caption = "Codice cliente fornitore" Object.Tag = "Codice cliente fornitore" MaxWidth = 6 End </code></pre> <p>Second match: </p> <pre class="lang-none prettyprint-override"><code> Begin PRJFW_EDITM.TXT_EDITM TXT_CLIFOR Height = 300 Left = 2685 DBField = "CG16_ANAG" Caption = "Codice cliente fornitore" Object.Tag = "Codice cliente fornitore" MaxWidth = 6 End </code></pre> <p>How can I do that? What's wrong in my regEx?</p> <p>Thank you.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload