in reply to Modifying muliple matched strings in text
Hint:
Call a function in the substitution part (activated by /e modifier) which returns your transformation.
s/PATTERN/replace($1,$2)/eg
Not sure if you even need to pass the matchgroups $1,... into the sub, but it's certainly more readable.
Edit
Pattern should match the links [$1]($2) (pseudo syntax).
I recommend using the /x flag for readability.
The transformations of $2 should happen inside the replace() sub
HTH!
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Modifying muliple matched strings in text
by nysus (Parson) on Jul 14, 2020 at 13:24 UTC |
In Section
Seekers of Perl Wisdom