my $string = 'here'; $string =~ s{([a-zA-Z\d\s\:\.\/\_\-]+)}{[id://$1|$2]}gs;