Reputation: 718
I'm trying to use regexp_replace replace every occurrence of type (number) (brackets with a number inside) with the expression ('number') (add ' before and after the number and by that - transform the number into varchar).
Example -
Before change: abcde(737)sbsgs37(6)s(v)
After change : abcde('737')sbsgs37('6')s(v)
Thanks,
Ilya Golosovsky.
Upvotes: 0
Views: 469
Reputation: 2242
All credit for Wernfried Domscheit as he just missed one little thing. You could use this one:
regexp_replace('abcde(737)sbsgs37(6)s(v)', '(\()(\d+)(\))', '\1''\2''\3')
Tested and worked:
select regexp_replace('abcde(737)sbsgs37(6)s(v)', '(\()(\d+)(\))', '\1''\2''\3') from dual
Upvotes: 1
Reputation: 59642
You can use this one
regexp_replace('abcde(737)sbsgs37(6)s(v)', '\((\d+)\)', '(''\1''))
-> abcde('737')sbsgs37('6')s(v)
Upvotes: 2