I have a table named marc and column named tag
this column contain a text like this:
"|a john dumas .|d 1941|e united states|=^A22306"
I want to read this text and extract only a substring which is between |a
and |d
.
the text should be this: john dumas.1941
I tried without success with:
select regexp_replace(tag, '(.*)_[^|][^a][^d]*$', '1')
from marc where id='10825700016';
can someone help me to solve this problem
2
Answers
You can use
substring()
to extract the part between|a
and|e
.Then use
replace()
to get rid of the.|d
You can do it using String functions such as
CONCAT
andsubstring
like in this DBFIDDLEThe trim function will also remove the leading spaces before
john
and afterdumas
Output: