http://qs1969.pair.com?node_id=11138614


in reply to Re^3: s///g within m//g regions
in thread s///g within m//g regions

# turn * into - within |...| regions
A |simple*example| is |so*simple| to come*up |with
these*days|
should become
# turn * into - within |...| regions
A |simple-example| is |so-simple| to come*up |with
these-days|
So, iterate over matches, and perform substs within each match.