Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Customers, Partners & Luminaries only: You're invited to a Data Analytics Roadmap session. Read More
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor II
Contributor II

How to load data that matches regular expression?

Trying to only load rows where URL matches regular expression ^domain\.com.

I solved it the way I did not want to with if(WildMatch([PageURL],'domain.com*'),'Yes','No') AS [MainDomain]- I would rather avoid creating a new column.

I Googled the living daylights of "qlik match regex in load" and its variations.

Below is another example of something that does not work:

LOAD
    DateOfPageview,
    PageURL,
    Pageviews
    FROM [lib://dataSource.qvd]
    WHERE [PageURL] REGEXP '^domain\.com'
(qvd);

Is it possible?

Thank you.

Labels (2)
3 Replies
Highlighted
Employee
Employee

I'm not familiar with the regular expression syntax, but based on your expression that worked, you could do something similar in the load statement.
...
WHERE [PageURL] like "*domain.com*"
Highlighted
Contributor II
Contributor II

Your suggestions worked, thank you.

Here's the script that worked:

LOAD
    DateOfPageview,
    PageURL,
    Pageviews
FROM [lib://dataSource.qvd]
(qvd)
WHERE [PageURL] like 'domain.com*';

I cannot mark my original question as solved, because this is an answer to a different question.

Highlighted
MVP & Luminary
MVP & Luminary

The "like" operator and the "Wildmatch()" function support wildcard characters "*" and "?".  It's good that you could resolve your particular requirement with like. 

Regular expression syntax is not currently supported in Qlik Sense out-of-the-box.  A couple of possible workarounds when you do need full regex:

1. Use the RegEx web connector https://help.qlik.com/en-US/connectors/Subsystems/Web_Connectors_help/Content/Connectors_QWC/Data-So...

2. Write your own (or borrow) your own RegEx implementation as a Server Side Extension. See https://github.com/RobWunderlich/qcb-qlik-sse

It would be great to see Regex function as native Qlik functions!

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com