I have regex with replace function which is working in SQL with Oracle:
regexp_replace(product_name, '\s+\-.*', '')
but it is not working in Spark SQL - looks, like matching is not working:
REGEXP_REPLACE(product_name, '\\s+\\((-.*)\\)', '')
How can I properly write it to get same results? In SQL with oracle I've replaced searched strings by '', but in Spark SQL nothing happened
I've tried to find regex by regexp_extract in Spark SQL - and I've got nulls
UPDATE: I've almost solved issue by using: ' \ -.*'. The problem is still when I have white spaces around my string - how can I take only string?
Solution with: \ -.* works like expected finally - thanks all!