Posted By

alli14404 on 01/19/09


Tagged

regex php character encoding


Versions (?)

Who likes this?

5 people have marked this snippet as a favorite

Scooter
umang_nine
f3ze
vali29
jatkins


Regex ignore html entities but replace any '&' with &


 / Published in: PHP
 

  1. preg_replace("/&(?![a-zA-Z0-9#]+;{1})/", "&", $str);
  2.  
  3.  
  4. Test here: http://regexpal.com/
  5. Regex: &(?![a-zA-Z0-9#]+;{1})
  6. Test case: &  j&j hh jk 8 $ & nnj & dasasd E&P d d&d 11

Report this snippet  

You need to login to post a comment.