Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

use of regular expressions

Hi,

I'm trying to exclude all words that begins with @ or # from a field.

so eg.

"@handelsbanken @SVTPlus @Swedbank @Nordea_SE @SEBSverige papers klipp sökes @PrinsDanne alt hjälp täkt I http://t.co/zz4xGLy1BR I @dfjsteve"

would come out something like: "papers klipp sökes, alt hjälp täkt"

I have tried to use some regular expressions in the load statement:

eg.

"parse('\s(\@+w|\#+w)[\s$]', '', [Tweets], 1) as Tweets"

or

"regex1(Tweets,'@\w*\s') as Tweets"


But the script editor won't take parse or regex as a valid function. is there any way to get around this problem.

Some advanced settings that i have missed or something else?


Thankful for any help!


BR

/Pierre

3 Replies
Anonymous
Not applicable
Author

Hi Pierre,

Here is my suggestion, Load the content using SubField() function to separate the message. Then Load again the table but this time, use a condition to remove all the words that start with '@' character and in the same load statement use concat() to rebuild the original message:

foto2.png

The first section of the code will generate a table like this one:

foto.png

And the second part, after filtering and grouping you will get this output:

foto.png

Hope it helps.

Best regards,

Karla

petter
Partner - Champion III
Partner - Champion III

I see that you have the grasp of Regular Expressions so you should have a look at Barry Harmsen's blog about "Regular Expressions in the load script":

     Google: qlikfix regular expression

And you find the tips you need I think.

HTH

- Petter

Not applicable
Author

Thanks Karla,

since i heard that regular expressions needs a macro (and macros don't work very good in Ajax), i think i will go with with your suggestion.

thanks!

br

/Pierre