Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
How can I replace/remove all the characters after the I get the 6 digits that I need?
My Data is:
Refer to ABC 123-456 06/13
My expression is:
row9.column == null ? null : row9.column.contains("Refer") ? row9.column.replace("(Refer to ABC","").replace("-","").replace("Refer ABC to","").replace("-","") : null
Output is:
123456 06/13
or if the column values doesn't have Refer then null
Expected and should be the output:
123456
How can I remove all the characters after every 6th number that I need to extract?
Hi,
It depends on your string length of input data. You will have to add additional logic to handle input strings which is having less length compared to current one.
The above post has helped you to break the barrier for your query for the input data shared in the post. But you will have to make necessary amendments based on your other input data 🙂
Don't worry, its not painful. I would say try for sometime of your own. If you are stuck, we all are here. You can share some sample data and we will see how it can be done. But I would strongly suggest you to give it a try for 2 to 3 hours so that you will learn basics thoroughly 🙂
Warm Regards,
Nikhil Thampi
Hi,
You will have to use java functions to do it. Please refer below job (I believe I had given another way to do it in an earlier post to you).
Job flow
tmap
trim_input expression in Var
row1.input.replaceAll("\\pL+","").trim()
Output expression
Var.trim_input.substring(0, Var.trim_input.indexOf(" ")).replace("-","")
If the answer has helped you, could you please mark the topic as resolved? Kudos are also welcome 🙂
Warm Regards,
Nikhil Thampi
This gives me outofboundindex error -1
Hi,
It depends on your string length of input data. You will have to add additional logic to handle input strings which is having less length compared to current one.
The above post has helped you to break the barrier for your query for the input data shared in the post. But you will have to make necessary amendments based on your other input data 🙂
Don't worry, its not painful. I would say try for sometime of your own. If you are stuck, we all are here. You can share some sample data and we will see how it can be done. But I would strongly suggest you to give it a try for 2 to 3 hours so that you will learn basics thoroughly 🙂
Warm Regards,
Nikhil Thampi