Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for DI and DA gurus. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Contributor III
Contributor III

Regextest

Hello All,

I'm having trouble in getting an alphanumeric word from a string, i have a column with addresses and i need to know whether the last word in that whole string is a pincode. so last word in the below column after ", " is a pincode.

Cannon Street, 25 Walbrook, London, EC4N 8AF
27 Poultry (Meet By Turkish Bank In Princes Street), London, EC2R 8AJ
1-7 Snowsfields, LONDON, SE1 3SU
The Grove, Chandlers Cross, RICKMANSWORTH, WD3 4TG
1 Solution

Accepted Solutions
Highlighted
Partner
Partner

Re: Regextest

You could test with len

If(Len(SubField(SubField(field,',',-1),' ',-1)=3,'Pincode','Missing')

But you have to be sure about len

View solution in original post

5 Replies
Highlighted
Partner
Partner

Re: Regextest

Hi

try to use this expression

 

SubField(SubField(field,',',-1),' ',-1)

Highlighted
Contributor III
Contributor III

Re: Regextest

No, I want to test if there is a pincode in the address in some cases the address columns are in the below way.

 

Cannon Street, 25 Walbrook, London, EC4N 8AF
27 Poultry (Meet By Turkish Bank In Princes Street), London, EC2R 8AJ
1-7 Snowsfields, LONDON
The Grove, Chandlers Cross, RICKMANSWORTH
*st Pancras Eurostar

 

Highlighted
Partner
Partner

Re: Regextest

You could test with len

If(Len(SubField(SubField(field,',',-1),' ',-1)=3,'Pincode','Missing')

But you have to be sure about len

View solution in original post

Highlighted
Contributor III
Contributor III

Re: Regextest

What if i want to specify the length between some range for suppose i want to get the for some pincodes are 3 digits and some are 4, could you please help me with this?

Highlighted
Partner
Partner

Re: Regextest

If(Len(SubField(SubField(field,',',-1),' ',-1)=3 or Len(SubField(SubField(field,',',-1),' ',-1)=4,'Pincode','Missing')