fork download
  1. <?php
  2.  
  3. $tag = '<string name="abs__action_bar_home_description">My old title</string>';
  4. $new_title = 'My new title';
  5.  
  6. $pattern = "/(<string[\s\w=\"]*>)([\w\s]*)(<\/string>)/i";
  7. $replacement = "$1".$new_title."$3";
  8. $result = preg_replace($pattern, $replacement ,$tag);
  9.  
  10. echo $result;
  11.  
  12. ?>
Success #stdin #stdout 0.03s 52480KB
stdin
Standard input is empty
stdout
<string name="abs__action_bar_home_description">My new title</string>