REPLACE OR DROP PART OF A STRING

Home / Uncategorized / REPLACE OR DROP PART OF A STRING

Question:
I am looking to drop or replace word(s) in a string.

Example:String = PINK LENOVO LAPTOP

Desired output = LENOVO

And so, I tried, REPLACE(PINK LENOVO LAPTOP’, ‘LENOVO’). But of course the out put for that will be: PINK LAPTOP

Any idea how I can drop PINK and LAPTOP or replace the whole string with just LENOVO. Any help will be greatly appreciated. Thank you!

EDIT1:
Just to clarify, I am trying to replace a string of words from a sentence with only one or two words.

So, for example I’d like to replace "PINK LENOVO LAPTOP – i7 16GB RAM" to "LENOVO – i7 16GB RAM"


Answer:
According to how I understand your requirements, it could be this one:REGEXP_REPLACE(REGEXP_REPLACE(‘PINK LENOVO LAPTOP’, ‘PINK ‘), ‘ LAPTOP’)
Read more

Leave a Reply

Your email address will not be published. Required fields are marked *