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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Logic needed for substring

Dear All,

I have a scenario to get the word beween particular characters.

ex: community\qlik\demo.com

I need to retrieve "demo" from the above string.    How i can achieve this??

Thanks in advance

7 Replies
Not applicable
Author

In brief .., i need the word after last occurance of '\' [slash]

Anonymous
Not applicable
Author

=subfield(subfield(String, '\' ,-1),'.',1)

giakoum
Partner - Master II
Partner - Master II

use index to find the position of \ and .

and then mid to retrieve the string

rubenmarin1

Hi Praful, you can get that with:

=Subfield(SubField(TextField, '\', -1), '.', 1)

rubenmarin1

Or

=Left(SubField(TextField, '\', -1), Index(SubField(TextField, '\', -1), '.', -1)-1)

Will return the text between the last '\' and the last '.'. If the last word has a dot before the last .xxx it will the the entire word, ie:

community\qlik\eu.demo.com --> returns eu.demo

=Subfield(SubField(TextField, '\', -1), '.', 1) will return only 'eu'

robert_mika
Master III
Master III

=TextBetween('community\qlik\demo.com','\','.',2)

Not applicable
Author

Hi There,

To really keep it dynamic I would use the following:

=TextBetween('community\qlik\demo.com','\','.',SubStringCount('community\qlik\demo.com','\'))

Hope it helps.