To solve it you need substitute functionality with regex, try to find in matlab's regexes something similar to this in php:
$string = 'http:xxx/sys/tags/Rel/total';
preg_replace('/http:(.*?)\//', 'http:${1}1/', $string);
${1}
means 1st match group, that is what in parenthesis, (.*?)
.
http:(.*?)\/
- match pattern
http:${1}1/
- replace pattern with second 1 as you wish to add (first 1 is a group number)
http:xxx/sys/tags/Rel/total
- input string
The secret is that whatever is matched by (.*?)
(whether xxx or yyyy or 1234) will be inserted instead of ${1}
in replace pattern, and then replace instead of old stuff into the input string. Welcome to see more examples on substitute functionality in php.