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

python - how we can use ajax() in views.py in django? -

matlab - Using loops to get multiple values into a cell -

python - Sequence Pattern recognition with Pybrain -