<?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 Mapsubstring only whole words? in Connectivity &amp; Data Prep</title>
    <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Mapsubstring-only-whole-words/m-p/2159613#M13198</link>
    <description>&lt;P&gt;Hi!&lt;/P&gt;
&lt;P&gt;I'm having issues using MapSubstring() to remove prepositions substrings from a string.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ReplacePreposition:&lt;BR /&gt;Mapping LOAD * Inline [&lt;BR /&gt;A,B&lt;BR /&gt;" da "," "&lt;BR /&gt;" de "," "&lt;BR /&gt;" do "," "&lt;BR /&gt;" das "," "&lt;BR /&gt;" dos "," "&lt;BR /&gt;"da "," "&lt;BR /&gt;"de "," "&lt;BR /&gt;"do "," "&lt;BR /&gt;"das "," "&lt;BR /&gt;"dos "," "&lt;BR /&gt;" em "," "&lt;BR /&gt;" por "," "&lt;BR /&gt;" até "," "&lt;BR /&gt;" ate "," "&lt;BR /&gt;" e "," "&lt;BR /&gt;" km. "," "&lt;BR /&gt;" km "," "&lt;BR /&gt;];&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SET vReplacePreposition = MapSubString('ReplacePreposition', cliente_rua_temp);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;TempTab:&lt;/P&gt;
&lt;P&gt;If(Not Match(Capitalize($(vReplacePreposicao)), $(vReplacePreposicao)), 'ENTRADA MANUAL') as x&lt;/P&gt;
&lt;P&gt;From y&lt;/P&gt;
&lt;P&gt;Where z;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After setting the table and a variable with the function, I call it during the table load to replace these 'special' substrings to compare the result. In this example, I'm checking if the word capitalization match.&amp;nbsp; 'Prepositions' are not capitalized normally, so I exclude them for a fair comparison.&lt;/P&gt;
&lt;P&gt;Note that in the map table, the strings are written considering leading and trailing spaces so I set the Verbatim = 1 to do so. Obviously the strings with both leading and trailing spaces will be perfectly replaced, the problem comes to the strings with only trailing spaces that will replace whatever string&amp;nbsp; with that ending, for instance:&lt;/P&gt;
&lt;P&gt;Full string: Aparecida Moreira Basso&lt;/P&gt;
&lt;P&gt;After mapping: Rua Apareci Moreira Basso&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way to replace only whole words, preferably not changing much of this logic?&lt;/P&gt;</description>
    <pubDate>Tue, 09 Jan 2024 13:43:37 GMT</pubDate>
    <dc:creator>pedrohenriqueperna</dc:creator>
    <dc:date>2024-01-09T13:43:37Z</dc:date>
    <item>
      <title>Mapsubstring only whole words?</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Mapsubstring-only-whole-words/m-p/2159613#M13198</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;
&lt;P&gt;I'm having issues using MapSubstring() to remove prepositions substrings from a string.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ReplacePreposition:&lt;BR /&gt;Mapping LOAD * Inline [&lt;BR /&gt;A,B&lt;BR /&gt;" da "," "&lt;BR /&gt;" de "," "&lt;BR /&gt;" do "," "&lt;BR /&gt;" das "," "&lt;BR /&gt;" dos "," "&lt;BR /&gt;"da "," "&lt;BR /&gt;"de "," "&lt;BR /&gt;"do "," "&lt;BR /&gt;"das "," "&lt;BR /&gt;"dos "," "&lt;BR /&gt;" em "," "&lt;BR /&gt;" por "," "&lt;BR /&gt;" até "," "&lt;BR /&gt;" ate "," "&lt;BR /&gt;" e "," "&lt;BR /&gt;" km. "," "&lt;BR /&gt;" km "," "&lt;BR /&gt;];&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SET vReplacePreposition = MapSubString('ReplacePreposition', cliente_rua_temp);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;TempTab:&lt;/P&gt;
&lt;P&gt;If(Not Match(Capitalize($(vReplacePreposicao)), $(vReplacePreposicao)), 'ENTRADA MANUAL') as x&lt;/P&gt;
&lt;P&gt;From y&lt;/P&gt;
&lt;P&gt;Where z;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After setting the table and a variable with the function, I call it during the table load to replace these 'special' substrings to compare the result. In this example, I'm checking if the word capitalization match.&amp;nbsp; 'Prepositions' are not capitalized normally, so I exclude them for a fair comparison.&lt;/P&gt;
&lt;P&gt;Note that in the map table, the strings are written considering leading and trailing spaces so I set the Verbatim = 1 to do so. Obviously the strings with both leading and trailing spaces will be perfectly replaced, the problem comes to the strings with only trailing spaces that will replace whatever string&amp;nbsp; with that ending, for instance:&lt;/P&gt;
&lt;P&gt;Full string: Aparecida Moreira Basso&lt;/P&gt;
&lt;P&gt;After mapping: Rua Apareci Moreira Basso&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way to replace only whole words, preferably not changing much of this logic?&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2024 13:43:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Mapsubstring-only-whole-words/m-p/2159613#M13198</guid>
      <dc:creator>pedrohenriqueperna</dc:creator>
      <dc:date>2024-01-09T13:43:37Z</dc:date>
    </item>
    <item>
      <title>Re: Mapsubstring only whole words?</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Mapsubstring-only-whole-words/m-p/2159634#M13200</link>
      <description>&lt;P&gt;It's kinda stupid actually, and quite obvious. I just had to add a trailing and leading space to the string so every substring will be " x " and therefore I won't need to specify 3x each condition:&lt;/P&gt;
&lt;P&gt;String = "Aparecida do Norte"&lt;/P&gt;
&lt;P&gt;Fixed = " Aparecida do Norte "&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now the replace table will only have values with spaces as well:&lt;/P&gt;
&lt;P&gt;" da " instead of "da " and " da" and " da "&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2024 14:26:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Mapsubstring-only-whole-words/m-p/2159634#M13200</guid>
      <dc:creator>pedrohenriqueperna</dc:creator>
      <dc:date>2024-01-09T14:26:48Z</dc:date>
    </item>
  </channel>
</rss>

