Skip to main content
Question

Compare 2 tables when one of them is regex

  • May 25, 2018
  • 6 replies
  • 25 views

Hi, I have one table with phone numbers and another with regex for possibles mobile/phone numbers. I'd like to extract which ones of the first ones are mobile and which ones are regular phones. is it possible with feature merger? Many thanks

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

6 replies

denizturan1985
Participant
Forum|alt.badge.img
  • Participant
  • 11 replies
  • May 25, 2018

Is it possible to add an example? It will be better if you can share a sample of the data which you are working on.


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • 2252 replies
  • May 25, 2018

You can use the string searcher, attribute creator, tester etc. to do that.

As you need to execute the regex on the attribute holding the numbers, so you cant use the feature merger for that.

Your requirement would use 2 string searchers.

Or one tester or one attributecreator with conditional attribute creation.


  • Author
  • 2 replies
  • May 29, 2018

Hi, as example I have a list of numbers such as 609412859, 650451278, 917173737, 925425693, and the another list with regex like

^[8-9]{1}[0-9]{1,2}[0-9]{6,7}$ for phone

^[6-7]{1}[0-9]{2}[0-9]{6}$ for mobile

so I can define which ones of the first list are phone and which ones mobile

the list is huge, this is just an example.

many thanks


takashi
Celebrity
  • 7843 replies
  • May 29, 2018

Hi, as example I have a list of numbers such as 609412859, 650451278, 917173737, 925425693, and the another list with regex like

^[8-9]{1}[0-9]{1,2}[0-9]{6,7}$ for phone

^[6-7]{1}[0-9]{2}[0-9]{6}$ for mobile

so I can define which ones of the first list are phone and which ones mobile

the list is huge, this is just an example.

many thanks

How many are there different regular expressions? Just two?

 


takashi
Celebrity
  • 7843 replies
  • June 3, 2018

If you have only a few patterns (regular expressions)  and they are static (i.e. won't be changed for each run), I think that configuring a conditional value for all possible regular expressions would be an easier solution, than reading regular expressions from the second table at run-time. The conditional value setting looks like:

If @Value(number) Contains Regex ^[8-9]{1}[0-9]{1,2}[0-9]{6,7}$
    Then phone
Else if @Value(number) Contains Regex ^[6-7]{1}[0-9]{2}[0-9]{6}$
    Then mobile
Else unknown 

If you need to get regular expressions and corresponding phone type names from the second table anyway, a possible way is: unconditionally merge all the regular expressions and phone type names to every phone number feature as a list attribute with a FeatureMerger, explode the list with a ListExploder, then use a Tester to test every feature whether its phone number matches the regular expression. In terms of the performance, however, it might be better write a Python script.


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • 2252 replies
  • June 4, 2018

phonelol.fmw

try this one