How to replace a string followed by any number with NULL .
Example [tag:1234:test][tag:5678:sql]
Here i need to replace tag:1234: with null
Result should be : [test][sql]
** tag string will be constant ,Numbers will vary .
Kindly help me on this.
How to replace a string followed by any number with NULL .
Example [tag:1234:test][tag:5678:sql]
Here i need to replace tag:1234: with null
Result should be : [test][sql]
** tag string will be constant ,Numbers will vary .
Kindly help me on this.
Here you go:
SELECT regexp_replace('[tag:1234:test][tag:5678:sql]', '\\[tag:\\d+:([^\\]]+?)\\]', '[\\1]', 'g')
It's done by using regexp_replace function with suitable regular expression and g (global) flag for replacing all matches.