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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
muralam
Creator
Creator

Split issue

As per my requirement i need split out integers values which I am trying to do for example

 "101. Asd-dfg , 103. Cdf-dfg-a,b,c"

Output

101

103

I tried normalizing then split function

This one case is not able to handle

​Any suggestions would be appreciated

Labels (4)
1 Reply
Anonymous
Not applicable

Hi

Create a function in a custom routine to use regex to extract the integer value, eg:

package routines;

 

import java.util.regex.*;

 

 

public class MyRoutine {

 

 

static Pattern pattern=Pattern.compile("\\d+");

static Matcher matcher=null;

static String result="";

   

  public static String findIntegerValue(String inputData) {

   matcher=pattern.matcher(inputData);

  

    while (matcher.find()) {

       if (result.equals("")){

       result=matcher.group();

       }else{

       result=result+","+matcher.group();

       }

  }

    return result;

     

  }

}

 

This function return a string result like "101,103", then you can use tNormalize to split the row to multiple rows.

 

Please try and let me know if you have any questions.

 

Regards

Shong