Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
dawgfather
Creator
Creator

Trim string before third instance of a character

I have a field that has a sometimes long and varied string - folder names in systems essentially.

I need to extract the last portion of the strings which happens to occur after the third instance of a forward slash ( / ).

Is there an easy method to count to the Nth instance of a character and then either trim everything before that, or keep everything after that - whichever way you want to think about it?

Sample data:

Given:

/vol/volume1/subvolume1

/vol/volume2/subvol23

/vol/volumeABCDE/filenameX

/vol/stringofcharacters/datafield

Wanted:

subvolume1

subvol23

filenameX

datafield

1 Solution

Accepted Solutions
vishsaggi
Champion III
Champion III

Try this?

LOAD *,

     Subfield(Given, '/', 4) AS GivenField INLINE [

Given

/vol/volume1/subvolume1

/vol/volume2/subvol23

/vol/volumeABCDE/filenameX

/vol/stringofcharacters/datafield

];

View solution in original post

1 Reply
vishsaggi
Champion III
Champion III

Try this?

LOAD *,

     Subfield(Given, '/', 4) AS GivenField INLINE [

Given

/vol/volume1/subvolume1

/vol/volume2/subvol23

/vol/volumeABCDE/filenameX

/vol/stringofcharacters/datafield

];