Welcome Guest, Not a member yet? Register   Sign In
special character matching
#1

[eluser]xwero[/eluser]
I'm adding some validation rules to my validate library and i wanted the string validation to recognize other characters than only the alpha_numeric characters so i've added these nice strings Smile
Code:
$special_vowels = "ÀÁÂÃÄÅÆÈÉÊËÌÍÎÏÒÓÔÕÖØÙÚÛÜàáâãäåæèéêëìíîïðòóôõöøùúûüýÿĀāĂ㥹ĒēĔĕĖėĘęĚěĨĩĪīĬĭĮįıIJijĴĵŌōŎŏŐőŒœŨũŪūŬŭŮůŰűŲųŶŷŸƠơƯưǍǎǏǐǑǒǓǔǕǖǗǘǚǛǜǺǻǼǽǾǿ";
$special_consonants = "çÇÐÑßñĆćĈĉĊċČčĎďĐđĜĝĞğĠġĢģĤĥĦħĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňʼnŊŋŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŴŵŶŷŸŹźŻżŽž";
$currency_symbols = '€£\$¢¥';
$special_punctuations = "¡";
$superscript = "ª²³¹";
$quotation = "\"'`´˝‘’‚‛“”„";

If people want to add characters please do. I'm not sure if every character can be read on all computers.

If there an easier way to match these characters, please tell me.
#2

[eluser]xwero[/eluser]
I've just did some research for the preg_x functions and it appears you should be able to do something like this (php.net)
Code:
preg_match('/[\pL\p]+/u',$str);
Which should match alpha characters but it doesn't work on my server. In fact i could even get the pattern /[\w]+/ to match a alphanumeric character. I will try later on other servers. But the \px should be able to identify all unicode alpha characters and it comes with a warning :
Quote:Matching characters by Unicode property is not fast, because PCRE has to search a structure that contains data for over fifteen thousand characters. That is why the traditional escape sequences such as \d and \w do not use Unicode properties in PCRE.




Theme © iAndrew 2016 - Forum software by © MyBB