http://qs321.pair.com?node_id=785828


in reply to conditional statement in substitution expression

You might split the regex into two. In the first the regex should have the first ([^\*]+) changed to ([^\*]*_[^\*]*). In regex two the second ([^\*]+) is changed. Note this will also substitute if BOTH substrings contain underscores, but you could use ([^\*_]+) to prevent that.