0

I have one column , which contain values like - $test test12$ test14 I have to update the value the between $$. like-$test done$ test14

I have tried to solve this by using :-

select REGEXP_REPLACE('$test test12$ test14','$(.*?)$','test done') from dual

But not working

Given String -$test test12$ test14 Expected result - $test done$ test14

1
  • What should happen if it has $test test12$ test14$ Commented Jun 17, 2019 at 5:03

1 Answer 1

3

The character $ is a rexeg metacharacter, which has a special meaning (it means the end of the input or current line). It you want to target literal $, then it needs to be escaped:

SELECT
    REGEXP_REPLACE('$test test12$ test14', '\$(.*?)\$','$test done$')
FROM dual;

The above outputs:

$test done$ test14
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.