php - Regex remove the specials chars and keep the accents and ()@-_'& chars -


In my existing PHP code I have many problems with special characters and I waned them to replace them with a regedx is. Do you know how I can do this?

I just want to accept:

All letters with all the letters () @ -_ '& amp;

My Reggae:

  preg_replace ('/ [^ \ p {L} 0-9 \ -] / u', '', $ string);   

All this is to download a regex file to create a clean header.

Thank you for the best help,

The characters allowed in the class can include:

  $ replace = preg_replace ("/ [^ \ p {L} 0-9 () @_ '& amp; -] + / u ", '', $ String);   

A quantifier is better to use + because the replacement process is more efficient because many letters are converted and converted into each call. .

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -