Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
pawe84
Creator
Creator

java routines to replace regex in a string?

Hi everyone

is it possible to create a java routines which can replace regex instead of using the tReplace component?
Example: There is a table which contains product column and product_description column.

This description also includes the words "do not offer" in different kinds like:
DO NOT OFFER, Do Not Offer, Do NOT Offer, don't offer, DON'T OFFER and some other writings.

Now those words have to replace by an empty space.

Is there an easy way to replace all different writings?

 

Thanks for any information.

Labels (2)
1 Reply
lennelei
Creator III
Creator III

Hi,

 

"Easy way", not sure but you can of course create a routine with a method that will remove all possible occurences of your list.

 

Please note that you can easily make a regex case unsensitive by adding "(?i)" at the beginning.

 

For example this :

"nice product Do NoT OfFeR to client".replaceAll("(?i)do not offer","")

will return that :

nice product  to client

 

Of course, it's not very clean 0683p000009MA9p.png and you'll have to ajust every time you see a new variation...

 

Regards