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

Index of string '* ??-??? *'

Hi there,

I need to find an index of string '* ??-??? *' where question mark is a single digit and a star is any number of characters. 2nd and 3rd digits are seperated by a dash and there are spaces before 1st anf after 5th digit.

Example

String: Berliner Str. 154 20-254 Chemnitz

Substring: 20-254

Result: 27

So far I used MapSubString replacing ??-??? with a special character and found the index but it happened that ??-??? appeared in another part of a string (e.g. String: Berliner Str. 146-148 20-254 Chemnitz; Substring: 46-148) and MapSubString won't work here as it can't cope with surrounding spaces (when mapping ' 46-148 ' MapSubString will actually map '46-148'). Any idea how to get that index?

Regards,

Przemek

4 Replies
swuehl
MVP
MVP

Przemek, could you post your current script snippet?

nagaiank
Specialist III
Specialist III

You may replace each digit with 'n' and then locate 'nn-nnn' using index() function

Not applicable
Author

I can't due to the problem described in the above example.

Not applicable
Author

I found a workaround - when loading data from a file instead of inline QV recognises surrounding spaces so I moved all MapSubString data to a file.