Question: Can you help me?
I'm trying to make a PHP Regex to accept only: **A-Z**, **a-z**, **0-9**, **(**, **)**, **!** and accented words(**á**,**é**,**í**,**ó**,**ú** and **Á**,**É**,**Í**,**Ó**,**Ú**) to filter a list.

I tried everyting and searched so much, and I'm not getting succcess...
What should I do?

@edit:

```
if (!preg_match("/^[\p{L}-]*$/u", $line)){

```

I already tried using this from this [thread](https://stackoverflow.com/questions/2133758/how-do-i-match-accented-characters-with-php-preg) but didn't worked.

What I'm trying to do? Accept only words that I want to filter this list:
[List](https://i.stack.imgur.com/8mKVU.png)

@edit2: Already tried convertind to UTF8, using iconv, mb\_convert\_encoding, etc...

Answer: 
It think this is what you are looking for:

```
if (preg_match("/[a-zA-Z0-9áéíóúÁÉÍÓÚ\s]*/", $line)){
    // line is ok
}

```

You can test here: <https://regex101.com/r/4Ozxw2/1>
Use this...

```html
<?php

$strings = ['test(yes)h#', 'test2%', '!test3', 'ó','-',',...','test'];

foreach($strings as $v) {
    if (preg_match("/^[\p{L}A-Za-z0-9! | #\((.*?)\)#]*$/u", $v)) {
        print $v . '<br/>';
    }
}

?>
```

I think this will solve your issue.