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 |
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")
)
;