Search code examples
talend

How to split an address in TALEND based on UPPER CASE values?


I want to split the below address from single column to multiple columns using talend.

Input

|ADDRESS|

|15 St. Patrick Rd NORTH WEST LONDON|

Expected Output

|ADDRESS_LINE1 | ADDRESS_LINE2 |

|15 St. Patrick Rd | NORTH WEST LONDON |


Solution

  • You can use these two following regex expressions allow to split your input ADDRESS as you specified :

    ADDRESS_LINE1 = StringHandling.TRIM( input.ADDRESS.replaceAll("^(.+?)(([A-Z]{2,}\\s*?)+)$", "$1") ) ;

    ADDRESS_LINE2 = StringHandling.TRIM( input.ADDRESS.replaceAll("^(.+?)(([A-Z]{2,}\\s*?)+)$", "$2") ) ; TMAP

    result