I have a string say a url like below
"www.regexperl.com/1234/34/firstpage/home.php"
Now i need to replace the 34 number that is the second occurrence of a number in the string with 2.
The resultant string should be like
"www.regexperl.com/1234/2/firstpage/home.php"
The challenge I m facing is when i try to store the value 34 and replace it , It is replacing the 34 in the number 1234 and gives the result like below
"www.regexperl.com/122/34/firstpage/home.php"
Kindly let me know a proper regex to solve the problem.