Answer by Vinay on 05 October 2021
I have modified the code slightly and it worked.
def matcher_des = issue.description =~ /\[~accountid:([\w:-]+)\]/
def description = issue.description
matcher_des.each {
target = nodeHelper.getUser(it[1])?.displayName
description = description.replace(it[0], target)
}
replica.description = description