Tip of the Week: How to search multiple strings for certain keywords?

This post has been republished via RSS; it originally appeared at: Azure Data Explorer articles.



Whenever you look for a way to search for multiple strings with specific keywords, you can leverage the following code Sample 

  • (?i) flag for case-insensitive lookup
  • \b for looking for full words (similar to ‘has’ string operator vs ‘contains’)
let any_of_the_following = dynamic(['FLORIDA','NEW YORK','GEORGIA']);
let any_of_the_following_regex = strcat(@'(?i)', @'\b(', strcat_array(any_of_the_following, "|"), @')\b');
    'We saw heavy rain in Florida',
    'This string does not contain any state.',
    'FloridaShould appear separately.',
    'NEW YORK is still popular destination among tourists',
| where tweet matches regex any_of_the_following_regex


We saw heavy rain in Florida

NEW YORK is still popular destination among tourists


“Join the conversation on the Azure Data Explorer community”.

REMEMBER: these articles are REPUBLISHED. Your best bet to get a reply is to follow the link at the top of the post to the ORIGINAL post! BUT you're more than welcome to start discussions here:

This site uses Akismet to reduce spam. Learn how your comment data is processed.