<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Get string enclosed in quotation marks in LabVIEW</title>
    <link>https://ni.lithium.com/t5/LabVIEW/Get-string-enclosed-in-quotation-marks/m-p/4252371#M1237396</link>
    <description>&lt;P&gt;Hi Luben.hristov&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I work with regular expressions, I test with &lt;A href="https://regex101.com/" target="_blank" rel="noopener"&gt;https://regex101.com/&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On this page, the help for * says:&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="LEd3h uNm38"&gt;*&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;matches the previous token between&amp;nbsp;&lt;SPAN class="GedSw"&gt;zero&lt;/SPAN&gt;&amp;nbsp;and&amp;nbsp;&lt;SPAN class="GedSw"&gt;unlimited&lt;/SPAN&gt;&amp;nbsp;times,&amp;nbsp;&lt;STRONG&gt;as many times as possible&lt;/STRONG&gt;, giving back as needed&amp;nbsp;&lt;SPAN class="hZ6T9"&gt;(greedy)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And in "(.*)" the quote (") is a valid match for . as long as another quote (") comes in the following characters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 30 Aug 2022 07:46:20 GMT</pubDate>
    <dc:creator>UliB</dc:creator>
    <dc:date>2022-08-30T07:46:20Z</dc:date>
    <item>
      <title>Get string enclosed in quotation marks</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Get-string-enclosed-in-quotation-marks/m-p/4252343#M1237380</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have to extract a string enclosed in quotation marks, following immediately after the field name (I'm doing some kind of JSON string analyses, using LV2014). Locating the field name is working as expected by using match pattern as shown below:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 200px;"&gt;&lt;img src="https://ip1.i.lithium.com/0b98c1e1801ce06a7e4a9e75f75c7f8c4587eba1/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f33303734333469353945424145443030344146464441452f696d6167652d73697a652f736d616c6c3f763d76322670783d323030" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;But when it comes to extract the string between the following two quotation marks things go weird. For example, field names are "bot seq" or "top seq" and the input the string is:&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;{"afe_loop_cfg":0,"n_afe_loop":0,"num_scanA":0,"num_scanB":0,"num_scanC":0,"cbTxPol":false,"cbTablePreload":true,"cbAnimAuto":true,"time auto":1,"bot seq":" 218, 64, 217, 65, 220, 62, 219, 63, 222, 60, 221, 61, 224, 58, 223, 59,\n 226, 56, 225, 57, 228, 54, 227, 55, 230, 52, 229, 53, 232, 50, 231, 51,\n 234, 48, 233, 49, 236, 46, 235, 47, 238, 44, 237, 45, 240, 42, 239, 43,\n 242, 40, 241, 41, 244, 38, 243, 39, 246, 36, 245, 37, 248, 34, 247, 35,\n 250, 32, 249, 33, 252, 30, 251, 31, 254, 28, 253, 29, 256, 26, 255, 27,\n 258, 24, 257, 25, 260, 22, 259, 23, 262, 20, 261, 21, 264, 18, 263, 19,\n 266, 16, 265, 17, 268, 14, 267, 15, 270, 12, 269, 13, 272, 10, 271, 11,\n 274, 8, 273, 9, 276, 6, 275, 7, 278, 4, 277, 5, 280, 2, 279, 3,\n 282, 0, 281, 1","top seq":" 66-211"}&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;The string is not multiline - i.e. \n is not NEW_LINE character but two characters '\' and 'n'&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried to use Match Regular Expression to extract the string enclosed in the quotation marks following the field, but I can't make it working for both&amp;nbsp;"bot seq" or "top seq" . I expected Match Regular Expression to work by using control string &lt;STRONG&gt;^"(.)"&lt;/STRONG&gt; but this is not the case - for&amp;nbsp;&lt;STRONG&gt;bot seq&lt;/STRONG&gt;&amp;nbsp;and&amp;nbsp;^"(.)" I get the following output (notice that &lt;STRONG&gt;top seq&lt;/STRONG&gt; field data is also there):&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;218, 64, 217, 65, 220, 62, 219, 63, 222, 60, 221, 61, 224, 58, 223, 59,\n 226, 56, 225, 57, 228, 54, 227, 55, 230, 52, 229, 53, 232, 50, 231, 51,\n 234, 48, 233, 49, 236, 46, 235, 47, 238, 44, 237, 45, 240, 42, 239, 43,\n 242, 40, 241, 41, 244, 38, 243, 39, 246, 36, 245, 37, 248, 34, 247, 35,\n 250, 32, 249, 33, 252, 30, 251, 31, 254, 28, 253, 29, 256, 26, 255, 27,\n 258, 24, 257, 25, 260, 22, 259, 23, 262, 20, 261, 21, 264, 18, 263, 19,\n 266, 16, 265, 17, 268, 14, 267, 15, 270, 12, 269, 13, 272, 10, 271, 11,\n 274, 8, 273, 9, 276, 6, 275, 7, 278, 4, 277, 5, 280, 2, 279, 3,\n 282, 0, 281, 1&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;","top seq":" 66-211&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 400px;"&gt;&lt;img src="https://ip1.i.lithium.com/2861dd0b44da2bb7801a06ffa08f39253481121a/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f33303734333669334534334338464133333443353646332f696d6167652d73697a652f6d656469756d3f763d76322670783d343030" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Somehow Match Regular expression gets confused by the quotation marks -&amp;nbsp;the output contains also the next field with the data, which is not what I need. I used very often Match Regular expression and till now it always worked as expected.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To patch the problem I made the string extraction by using Search array function (attached VI), but still curious why Match Regular Expression is not working. Also tried to use Match Pattern instead of Match Regular&amp;nbsp; Expression, but the result was the same - can't get correctly the data enclosed in quotation marks.&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The question is - how I can get correctly the string enclosed by quotation marks when using Match Regular Expression or Match Pattern?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2022 03:50:32 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Get-string-enclosed-in-quotation-marks/m-p/4252343#M1237380</guid>
      <dc:creator>Luben.hristov</dc:creator>
      <dc:date>2022-08-30T03:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: Get string enclosed in quotation marks</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Get-string-enclosed-in-quotation-marks/m-p/4252359#M1237388</link>
      <description>&lt;P&gt;I am not sure if I understood your issue correctly.&lt;/P&gt;
&lt;P&gt;Does&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;"([^"]*)"&lt;/LI-CODE&gt;
&lt;P&gt;return what you want?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2022 05:55:20 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Get-string-enclosed-in-quotation-marks/m-p/4252359#M1237388</guid>
      <dc:creator>UliB</dc:creator>
      <dc:date>2022-08-30T05:55:20Z</dc:date>
    </item>
    <item>
      <title>Re: Get string enclosed in quotation marks</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Get-string-enclosed-in-quotation-marks/m-p/4252369#M1237395</link>
      <description>&lt;P&gt;Hi UliB,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the suggestion - with your suggested string really works! It makes perfect sense - search for quotation, then for anything different from quotation mark and at the end for the second quotation.&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;^"([^"]*)"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;Still curious why ^"(.*)" is not working - it's technically doing the same thing, except that &amp;gt;&lt;STRONG&gt;.&lt;/STRONG&gt;&amp;lt; is searching for any character.&amp;nbsp; Once the second quotation mark appears, ^"(.*)"&amp;nbsp;should complete the search (which is not happening always in my example).&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2022 07:40:33 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Get-string-enclosed-in-quotation-marks/m-p/4252369#M1237395</guid>
      <dc:creator>Luben.hristov</dc:creator>
      <dc:date>2022-08-30T07:40:33Z</dc:date>
    </item>
    <item>
      <title>Re: Get string enclosed in quotation marks</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Get-string-enclosed-in-quotation-marks/m-p/4252371#M1237396</link>
      <description>&lt;P&gt;Hi Luben.hristov&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I work with regular expressions, I test with &lt;A href="https://regex101.com/" target="_blank" rel="noopener"&gt;https://regex101.com/&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On this page, the help for * says:&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="LEd3h uNm38"&gt;*&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;matches the previous token between&amp;nbsp;&lt;SPAN class="GedSw"&gt;zero&lt;/SPAN&gt;&amp;nbsp;and&amp;nbsp;&lt;SPAN class="GedSw"&gt;unlimited&lt;/SPAN&gt;&amp;nbsp;times,&amp;nbsp;&lt;STRONG&gt;as many times as possible&lt;/STRONG&gt;, giving back as needed&amp;nbsp;&lt;SPAN class="hZ6T9"&gt;(greedy)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And in "(.*)" the quote (") is a valid match for . as long as another quote (") comes in the following characters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2022 07:46:20 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Get-string-enclosed-in-quotation-marks/m-p/4252371#M1237396</guid>
      <dc:creator>UliB</dc:creator>
      <dc:date>2022-08-30T07:46:20Z</dc:date>
    </item>
    <item>
      <title>Re: Get string enclosed in quotation marks</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Get-string-enclosed-in-quotation-marks/m-p/4252377#M1237399</link>
      <description>&lt;P&gt;Hi&amp;nbsp;UliB,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for the explanation - now it makes sense why sometimes it works and sometimes not.&lt;/P&gt;
&lt;P&gt;Personally I use one test VI where it's possible quickly to experiment with different regular expression strings - see attached. It has some basic syntax analyses of the regular expression and colours the characters to highlight the groups (see attached LLB).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your link for the regular expressions is definitely very useful, thanks for the hint.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2022 08:19:08 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Get-string-enclosed-in-quotation-marks/m-p/4252377#M1237399</guid>
      <dc:creator>Luben.hristov</dc:creator>
      <dc:date>2022-08-30T08:19:08Z</dc:date>
    </item>
    <item>
      <title>Re: Get string enclosed in quotation marks</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Get-string-enclosed-in-quotation-marks/m-p/4252406#M1237415</link>
      <description>&lt;P&gt;Hello Hristov,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;there is another, easier solution for your problem. As UliB stated, the normal behavior is to be greedy. But with the modifier '?' it is possible to change the behavior of a quantifier to be eager. As the offline help (LabVIEW2019) for the special character '?' says:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE class="Bordered"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="Bordered"&gt;When used immediately after a quantifier, &lt;SPAN class="Monospace"&gt;?&lt;/SPAN&gt; modifies the quantifier to match as few times as possible. Modifiable quantifiers include &lt;SPAN class="Monospace"&gt;*&lt;/SPAN&gt;, &lt;SPAN class="Monospace"&gt;+&lt;/SPAN&gt;, and &lt;SPAN class="Monospace"&gt;{}&lt;/SPAN&gt;.&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So the following search string works the same:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;"bot seq":"(.*?)",&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And this example shows how to get rid of the "Match Pattern" funktion to remove the first string part.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Match Regular Expression - Eager.png" style="width: 587px;"&gt;&lt;img src="https://ip1.i.lithium.com/d82c1c77873a385c6907c7ef717b4bac2011450b/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f33303734343369324332423531443630304631383036332f696d6167652d73697a652f6c617267653f763d76322670783d393939" role="button" title="Match Regular Expression - Eager.png" alt="Match Regular Expression - Eager.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;DIV id="blinkextension_snap_links_box_mg_mouse_gestures" style="background-color: rgba(250, 128, 0, 0.07); border: 3px dashed blue; box-sizing: border-box; position: absolute; z-index: 2147483647; display: none; left: 363px; top: 438px;"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV id="hit_a_link_blinkextension_container_mg_mouse_gestures" style="display: none; position: absolute; left: 0px; top: 0px; width: 0px; height: 0px; z-index: 2147483647; background: rgba(0, 0, 0, 0) none repeat scroll 0% 0%;"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Tue, 30 Aug 2022 12:03:31 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Get-string-enclosed-in-quotation-marks/m-p/4252406#M1237415</guid>
      <dc:creator>daveTW</dc:creator>
      <dc:date>2022-08-30T12:03:31Z</dc:date>
    </item>
    <item>
      <title>Re: Get string enclosed in quotation marks</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Get-string-enclosed-in-quotation-marks/m-p/4252407#M1237416</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Luben.hristov&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;another regular expression you can try is&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;"(.*?)"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="LEd3h uNm38"&gt;*?&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;matches the previous token between&amp;nbsp;&lt;SPAN class="GedSw"&gt;zero&lt;/SPAN&gt;&amp;nbsp;and&amp;nbsp;&lt;SPAN class="GedSw"&gt;unlimited&lt;/SPAN&gt;&amp;nbsp;times,&amp;nbsp;&lt;STRONG&gt;as few times as possible&lt;/STRONG&gt;, expanding as needed&amp;nbsp;&lt;SPAN class="hZ6T9"&gt;(lazy)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="hZ6T9"&gt;Edit: daveTW was a minute faster.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2022 12:08:12 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Get-string-enclosed-in-quotation-marks/m-p/4252407#M1237416</guid>
      <dc:creator>UliB</dc:creator>
      <dc:date>2022-08-30T12:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: Get string enclosed in quotation marks</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Get-string-enclosed-in-quotation-marks/m-p/4252409#M1237417</link>
      <description>&lt;P&gt;Hi Dave,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This information about "?" modifier is new for me - it is changing the behaviour of the Match Regular expression exactly to what I need.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for the great idea!&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2022 12:08:37 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Get-string-enclosed-in-quotation-marks/m-p/4252409#M1237417</guid>
      <dc:creator>Luben.hristov</dc:creator>
      <dc:date>2022-08-30T12:08:37Z</dc:date>
    </item>
    <item>
      <title>Re: Get string enclosed in quotation marks</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Get-string-enclosed-in-quotation-marks/m-p/4252410#M1237418</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;UliB,&lt;/P&gt;
&lt;P&gt;You posted simultaneously with Dave the information about the "?" modifier. I feel privileged to get such quick solution for the LV problems &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2022 12:16:28 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Get-string-enclosed-in-quotation-marks/m-p/4252410#M1237418</guid>
      <dc:creator>Luben.hristov</dc:creator>
      <dc:date>2022-08-30T12:16:28Z</dc:date>
    </item>
  </channel>
</rss>

