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: 
DY94
Contributor II
Contributor II

How to check column that contain letter and number

Hello,

My columns must contains 2 letter and 4 number like this (AV1234)

How can i check this ?

Please anyone it's Urgent !

Thank you.

Labels (5)
1 Solution

Accepted Solutions
DY94
Contributor II
Contributor II
Author

Hello @Shicong Hong​ ,

 

Thank you for your answer !

 

This is my first time with routine ! and it works !

 

My code:

 

public static Boolean MyPattern(String str) {

String stringPattern = "[A-Z]{2}[0-9]{4}"; 

boolean match = Pattern.matches(stringPattern, str);

return match ;

  }

View solution in original post

4 Replies
Anonymous
Not applicable

Hi

Create a user routine and write a function to check it using regex, call the routine in the job.

 

Regards

Shong

manodwhb
Champion II
Champion II

@DY _BI​ , you can try to use the below one

 

StringHandling.LEN((row1.col).replaceAll( "[^\\d]", "" ))

DY94
Contributor II
Contributor II
Author

Hello @Shicong Hong​ ,

 

Thank you for your answer !

 

This is my first time with routine ! and it works !

 

My code:

 

public static Boolean MyPattern(String str) {

String stringPattern = "[A-Z]{2}[0-9]{4}"; 

boolean match = Pattern.matches(stringPattern, str);

return match ;

  }

DY94
Contributor II
Contributor II
Author

Thank you @Manohar B​