0

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?

2
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by minitauros
0

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.

Edited by minitauros: n/a

0

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!

Edited by riseguim: n/a

0

$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.

0

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

Thanks again buddy!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.