You want to use a \ to escape a character not a / On Thu, Nov 12, 2009 at 1:23 AM, Julia <julia...@yahoo.com> wrote:
> Hello, > > I have created a custom validator that uses the php function > preg_match. > One of the parameters I pass to my validator is an array of characters > that I consider as valid. This results in a regular expression > e.x. "/[^a-z¦¨´...@]/i". > This works great, but is “broken” as soon as I want to add the single > quote character as a valid character in the passed array to be > matched: the following does not work:- > "/[^A-Z¦¨´¸-@/']/i". > Notice /' at the end of the regular expression (escaped single-quote)? > I am aware that such a character must be escaped and I tried different > things to do so but cannot manage to get it to work. If anybody could > come with the solution (tested) rather than assumption (I guess I came > across and tried most of them in forums). > I spent about 2 hours on search engines and found out that many people > hit the same issue with this particular character but no solution or > even follow-up on the half-dozen posts I came across. > Any help on this would be really appreciated; in return I’ll make sure > it is diffused sufficiently on the net so that in the future nobody is > stuck on this issue :) > > -- > > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To post to this group, send email to cake-...@googlegroups.com. > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com<cake-php%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/cake-php?hl=. > > > -- You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-...@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/cake-php?hl=.