You are not logged in.
Announcement
Unanswered posts
|
Pages: 1

Hi all,
first I didn't know where to write down my question, anyways, I'm new in talend and I'm using an EXCEL file as a DB source and another one for the output (just trying the treplace before using a postgresql db output) and I'm trying to replace all what's written in a field named PRODUCT, which contains something kinda "OPGSM001OPERATION_P" (including special characters like _ or - and so on) with nothing but "GSM" but in vain, I've been using both simple and advanced mode trying something like : "[A-Za-z]*GSM*[A-Za-z]" or "[A-Za-z]([0-9]{10})*GSM*[A-Za-z]([0-9]{10}) and many other options and bunch of stuff and each time it gives a different unwanted result (just like writing GSM twice or many errors instead...) . any help please I'm kinda desperate.
thanks a lot.
Offline
Hi
Sorry, I don't understand you well, what are your expected result? Can you give us an example to explain your request?
Best regards
Shong
Offline

hi shong,
yes of course, actually in a column named PRODUCT, I want to replace the content of all rows containing "GSM" with nothing but "GSM" . for exemple: we have indeed in the column PRODUCT, in the first row there is "PSGSMPROD_01", in the third row we have "PSGSMACTIVATED_00112" and so on... so, I want in the same column and in the same rows "PSGMPOD_01" and each row containing GSM to be replaced by "GSM". I hope made my problem clear this time lol I've been trying many options but in vain. I'll be so gratful for any help
thanks a lot .
greetings
Offline
Hi
It seems you only need a simple expression on tMap as below:
row1.PRODUCT.contains("GSM")?"GSM":row1.PRODUCT
Best regards
Shong
Offline

Hi
Thanks a lot shong it actually worked, and I tried row1.PRODUCT_ID.matches("([A-Za-z0-9- ]+)GSM([A-Za-z0-9_ ]+)") ? "GSM" : "CDMA" as well. but it took more to work with matches than with contains. I'm so grateful.
best regards.
Offline
fantom wrote:
Hi
Thanks a lot shong it actually worked, and I tried row1.PRODUCT_ID.matches("([A-Za-z0-9- ]+)GSM([A-Za-z0-9_ ]+)") ? "GSM" : "CDMA" as well. but it took more to work with matches than with contains. I'm so grateful.
best regards.
Cool,
thanks for your feedback!
Best regards
Shong
Offline
How will i add more values ? Like ( MOBILE, WIRELESS, GSM). Want to convert it to GSM.
treplace not worth it.
Pages: 1