I have a text string i want to replace it by another text using regexp
Means each word replaced with a specific word
input= Jounal Page Year DOI Roche-Link
my expected output
output = Publication Title Pagination Publication Date Digital Object Identifier Roche Link
Journal replace by Publication Title
Page replace by Pagination
Year replace by Publication Date
DOI replace byDigital Object Identifier
Roche-Link replace by Roche Link
- my regex=\b(Journal|Year|Page|DOI|Roche-Link)\b
my regexp Detect all the specific words but I didn't find a solution using $
to replace each word the with the specific word
output = input.replace(/\b(Journal|Year|Page|DOI|Roche-Link)\b/g, (Publication Title)+$1, (Pagination)+$2,(Publication Date)+$3,(Digital Object Identifier)+$4,(Roche Link)+$5)