Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Removing Substring in Load Script

Hello,

  How would I go about removing a substring whenever I find a specific pattern in a field in the load script.

Example:

     If the string is http://www.internet.com/specificpage.cfm?id=12345

     I would want to grab the '12345' everytime there is '/specificpage.cfm?id='

     Even if the url was http://www.internet.com/specificpage.cfm?id=12345&other=stuff

So I am trying to find a specific pattern, note its place in the string, and then make a substring with the 5 characters after that position... I think

I have gotten this far before getting stumped:

load

IF(wildmatch(URL,'*/specificpage.cfm?id=*')=1,SUBSTRING STUFF HERE,0) as id_substring;

SELECT

etc...

Thanks!,

Tyler

1 Solution

Accepted Solutions
swuehl
MVP
MVP

try using index function to get the position of your substring, like

as SUBSTRING STUFF HERE:

mid(URL,index(URL,'/specificpage.cfm?id=')+21, 5)

where 21 is the count of characters in your searchstring (hope I counted correctly).

Hope this helps,

Stefan

View solution in original post

2 Replies
swuehl
MVP
MVP

try using index function to get the position of your substring, like

as SUBSTRING STUFF HERE:

mid(URL,index(URL,'/specificpage.cfm?id=')+21, 5)

where 21 is the count of characters in your searchstring (hope I counted correctly).

Hope this helps,

Stefan

Not applicable
Author

Works, thanks!