<?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: Regex Match in tMap Expression Builder in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Regex-Match-in-tMap-Expression-Builder/m-p/2197844#M1428</link>
    <description>I'm trying to use the tMap expression builder to apply a regex match on VAT registration numbers based on the country. I want to do this using a lookup variable rather than writing an explicit expression in the tMap for each of the country numbering format variations. 
&lt;BR /&gt;I can get the expression below to work for UK VAT numbers... 
&lt;BR /&gt;Relational.ISNULL(row3.Vat_Reg_Number)==false&amp;amp;&amp;amp;row3.Vat_Reg_Number.matches("^()*((\\d{8})|(\\d{11})|(GD\\d{2})|(HA\\d{2}))$")==true? "VAT number OK" : "VAT number is incorrectly formatted" 
&lt;BR /&gt;I?m looking to do something like this? 
&lt;BR /&gt;Relational.ISNULL(row3.Vat_Reg_Number)==false&amp;amp;&amp;amp;row3.Vat_Reg_Number.matches((row4.vat_reg_regex))==true? "VAT number OK" : "VAT number is incorrectly formatted" 
&lt;BR /&gt;?where ( row4.vat_reg_regex ) is a lookup from a database table keyed on the country. So far I have not been able to get this to work. 
&lt;BR /&gt;Does anyone know if this approach is workable or not?</description>
    <pubDate>Wed, 28 Nov 2012 08:49:11 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2012-11-28T08:49:11Z</dc:date>
    <item>
      <title>Regex Match in tMap Expression Builder</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Regex-Match-in-tMap-Expression-Builder/m-p/2197842#M1426</link>
      <description>Hi,
&lt;BR /&gt;I am new to Talend and want to say so far I am very impressed. I deal with tons of data that is very inconsistent and am trying to find a quick example of using a regular expression in the Expression builder within a tMap. After hunting around I found this gem, and though it would be useful to others:
&lt;BR /&gt;Given you have the equivelent of an Enum data type you want to use.. and people keep giving you bad data like:
&lt;BR /&gt;row1.Classification data:
&lt;BR /&gt;
&lt;PRE&gt;brown pear&lt;BR /&gt;rotten apples&lt;BR /&gt;salt rocks&lt;BR /&gt;red apples&lt;BR /&gt;green apple&lt;BR /&gt;pear pectin&lt;/PRE&gt;
&lt;BR /&gt;This code in the expression builder:
&lt;BR /&gt;
&lt;PRE&gt;row1.Classification.toLowerCase().matches(".*apple.*")?"Apple":row1.Classification.toLowerCase().matches(".*pear.*")?"Pear":row1.Classification.toLowerCase().matches(".*salt.*")?"Salt":"Unknown"&lt;/PRE&gt;
&lt;BR /&gt;yeilds clean data:
&lt;BR /&gt;
&lt;PRE&gt;Pear&lt;BR /&gt;Apple&lt;BR /&gt;Salt&lt;BR /&gt;Apple&lt;BR /&gt;Apple&lt;BR /&gt;Pear&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 Jul 2012 16:18:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Regex-Match-in-tMap-Expression-Builder/m-p/2197842#M1426</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-27T16:18:54Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Match in tMap Expression Builder</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Regex-Match-in-tMap-Expression-Builder/m-p/2197843#M1427</link>
      <description>You can also make your regex case-insensitive i.e. instead of .toLowerCase().matches(".*pear.*") use .matches("(?i).*pear.*")</description>
      <pubDate>Mon, 30 Jul 2012 00:48:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Regex-Match-in-tMap-Expression-Builder/m-p/2197843#M1427</guid>
      <dc:creator>alevy</dc:creator>
      <dc:date>2012-07-30T00:48:21Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Match in tMap Expression Builder</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Regex-Match-in-tMap-Expression-Builder/m-p/2197844#M1428</link>
      <description>I'm trying to use the tMap expression builder to apply a regex match on VAT registration numbers based on the country. I want to do this using a lookup variable rather than writing an explicit expression in the tMap for each of the country numbering format variations. 
&lt;BR /&gt;I can get the expression below to work for UK VAT numbers... 
&lt;BR /&gt;Relational.ISNULL(row3.Vat_Reg_Number)==false&amp;amp;&amp;amp;row3.Vat_Reg_Number.matches("^()*((\\d{8})|(\\d{11})|(GD\\d{2})|(HA\\d{2}))$")==true? "VAT number OK" : "VAT number is incorrectly formatted" 
&lt;BR /&gt;I?m looking to do something like this? 
&lt;BR /&gt;Relational.ISNULL(row3.Vat_Reg_Number)==false&amp;amp;&amp;amp;row3.Vat_Reg_Number.matches((row4.vat_reg_regex))==true? "VAT number OK" : "VAT number is incorrectly formatted" 
&lt;BR /&gt;?where ( row4.vat_reg_regex ) is a lookup from a database table keyed on the country. So far I have not been able to get this to work. 
&lt;BR /&gt;Does anyone know if this approach is workable or not?</description>
      <pubDate>Wed, 28 Nov 2012 08:49:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Regex-Match-in-tMap-Expression-Builder/m-p/2197844#M1428</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-11-28T08:49:11Z</dc:date>
    </item>
  </channel>
</rss>

