Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Extract Multiple Hashtags from text
Go
New
Search
Notify
Tools
Reply
  
[SOLVED] Extract Multiple Hashtags from text
 Login/Join
 
Member
posted
I tried to figure this one out myself, but I was unsuccessful. Any suggestions would be appreciated.

I have a large text field (A500) and I need to extract each word that begins with a hashtag '#' into a separate column within an Excel document.

Example data text: A boy name #Jack ran up the #hill to fetch a pail of #water on #11/14/2016.

From the example I am hoping to extract #Jack, #hill, #water, and #11/14/2016 and then place them into an output where each hashtag is a separate field. In the example there will be four columns, but the text field can be random. Could be zero hashtags or could be up to 10.

This message has been edited. Last edited by: ChadSS,
 
Posts: 26 | Location: Jackson, MS | Registered: January 22, 2010Reply With QuoteReport This Post
Expert
posted Hide Post
Look at using GETTOK.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.06 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5573 | Location: United Kingdom | Registered: April 08, 2004Reply With QuoteReport This Post
Virtuoso
posted Hide Post
GETTOK is the way to go:
  
-* File CHAD01.fex
DEFINE FILE CAR
STRING/A500='A boy name #Jack ran up the #hill to fetch a pail of #water on #11/14/2016';
MYSTRING/A502='#x' || STRING;
-REPEAT #HASH FOR &I FROM 1 TO 10;
-SET &J=&I + 1;
PHASH&I/A200=GETTOK(MYSTRING, 501, &J, '#', 200, 'A200');
THASH&I/A20=GETTOK(PHASH&I, 200, 1, ' ', 20, 'A20');
HASH&I/A21=IF THASH&I EQ ' ' THEN ' ' ELSE '#' || THASH&I;
-#HASH
END

TABLE FILE CAR
PRINT COUNTRY NOPRINT
-REPEAT #TAGS FOR &I FROM 1 TO 10;
HASH&I
-#TAGS
IF RECORDLIMIT EQ 1
END


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

 
Posts: 1932 | Location: Tel Aviv, Israel | Registered: March 23, 2006Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Sweet... Smiler
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Reply With QuoteReport This Post
Member
posted Hide Post
Thanks Danny-SRL, worked like a charm.
 
Posts: 26 | Location: Jackson, MS | Registered: January 22, 2010Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Extract Multiple Hashtags from text

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.