For some reason, people cannot write apostrophes without resulting with an error... For example: Prud'homme will not work

Here's my line of code:

$string_exp = "/^[A-Za-zé.¸UûÙùàÀèÈéÉïÏîÎôÔêÊçÇ .,\'-]+$/";

I don't understand why it doesn't work, does someone know?

I don't know everything about regexps, but a dot should be escaped, or it will be treated as "any character". A dot matches any charachter if it is not escaped properly.

Same goes for the comma and dash, backslash and ', in other words, all characters that have a function within a regexp. They should all be escaped properly. [A-Z] means A to Z, while [A\-Z] means A, - and Z.

So how should I change my code in order for this to work? I'm kind of a google learner so I don't fully understand it yet

Thank you for helping buddy I really need it!

$string_exp = "/^[A-Za-zé\.¸UûÙùàÀèÈéÉïÏîÎôÔêÊçÇ \,\\\'\-]+$/";

Although I'm not sure if all those special characters will work. Never tried it, so I'm not certain.

IT WORKS !!! Thank you so much for you help, you just made my entire day!

Thanks again buddy!