regex - PHP preg replace to change last two character in whole string -


hello developers have problem in preg_replace.

i have text file includes :

#define fwte_black "{000000ff #define fwte_test "{006600ff  .. 

[edit] complete here : https://eval.in/133942

[edit] solved : http://gyazo.com/6cb4ec7b1ede1f99cda749b1863feefc in topic

i want replace ending ff on each line }"

will :

#define fwte_black "{000000}" #define fwte_test "{006600}"  .. 

please me. thanks

try :

preg_replace('/(.*)[f]{2}$/','$1}"','#define fwte_black "{000000ff'); 

based on comment update:

echo preg_replace('/(.*)[f]{2}([\n\r])+/','$1}"$2',$mystring); 

http://ideone.com/uosent


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -