I'm using preg match with php and discovered some weird behaviour as shown below (behaviour seems to be consistent across any version):
var_dump(preg_match('/[£]/', '«')); // true
var_dump(preg_match('/£/', '«')); // false
var_dump(preg_match('/[»]/', '«')); // true
var_dump(preg_match('/»/', '«')); // false
I would expect all of those expressions to return false however when using square brackets in regex (meaning match any char in this set) the regex returns true. I did check beforehand that multibyte strings were supported and was informed that that was the case however I may be mistaken? I would normally use the mb_ereg alternatives however there is not one for preg_replace_callback which is what I want to use. At the end of the day I just want to know what's going on here , I've found a workaround so that's not much of a problem but this just seems like really weird behaviour!