I have strings in the form \\d+_\\d+ and I want to add 1 to the second number. Since my explanation is so very clear, let me give you a few examples:
\\d+_\\d+
Here's the solution for the PHP 5.3 (now when PHP supports lambdas)
$new = preg_replace_callback("/(\d+_)(\d+)", function($matches) { return $matches[1] . (1 + $matches[2]); } , $new);