Skip to main content

#USA0 discussing

Hello

Imagine I have the following text:

 

⌗USA and ⌗Brazil are great places to live

 

And I want to extract only the word next to the #. In case that we have more than 2 #, then bring all ⌗words

 

How would the Regex expression look like? I tried this

 

REGEXP_EXTRACT([snippet],'(#\S+)')

 

but it only brings me ⌗USA

 

Regex Extract hashtags 

Thanks in advance

Rodrigo

4 answers
  1. Jul 29, 2022, 10:56 PM

    HI Rodrigo,

    Understand...however, the Regex in Tableau (so far as I've seen) doesn't support a looping or iterative process to allow for multiple word patterns to be pulled from a string/sub-string. So your best bet at that point would be to split on the # and then concatenate back again...or you could use this hacky method of nested IFNULL's to get up to two # hashtag words out of a string:

    IFNULL('#'+STR(IFNULL(REGEXP_EXTRACT([Data],'(?:.*?#){1}(\w+)'),REGEXP_EXTRACT([Data],'#(\w+)')))

    +', #'+STR(REGEXP_EXTRACT([Data],'(?:.*?#){2}(\w+)')), '#'+STR(REGEXP_EXTRACT([Data],'#(\w+)')))

    Which would return the following:

    HI Rodrigo,Understand...however, the Regex in Tableau (so far as I've seen) doesn't support a looping or iterative process to allow for multiple word patterns to be pulled from a string/sub-string.I guess just repeat the ifnull segments for as many possible iterations that might be in the data?

     

    Best, Don

0/9000

Job Title: Salesforce OmniStudio Developer

 

Location: Remote (US-based only)

Hourly Rate: $50-$60

Requirements: should have H1 visa or work permit. Candidates must be ready for a video interview.

 

Interested candidates should be prepared for a video interview and ensure they meet the required qualifications. Apply by submitting your resume on this email: reham.s@plumlogix.com

 

hashtag

#salesforce 

hashtag

#OmniStudio 

hashtag

#salesforceomnistudio 

hashtag

#remote 

hashtag

#USA 

hashtag

#salesforocedeveloper

0/9000