Re: Q on RegExp & extended Char

From: Date: Mon, 15 Dec 2003 17:45:59 +0000
Subject: Re: Q on RegExp & extended Char
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-172744@lists.php.net to get a copy of this message
Well have you thought about maybe an array of illegal or extended characters and simply replacing them? eg. $b = $_POST['whatever_variables_you_have']; $match = array("ö","ç","ä"); $replace = array("o","c","a"); $z = str_replace($match,$replace,$b); Might not be exactly what you want but hope it helps. Jas Jswalter wrote:
I've hit my limit on regular expressions. I need to check a string to see if it contains legal characters... A thru Z [a-z], SPACE, PERIOD, DASH/HYPHEN, APOSTROPHE [\' -,\.] OK, this is not a problem. My problem comes in with extended characters, as these examples... González Vänligen före innehålla I'm trying to build a RegExp that will see if the string is a proper name format or not. Names only have A thru Z, extended characters for other languages (than English), SPACE, PERIOD, DASH/HYPHEN, APOSTROPHE Dr. Roger O'Malley Mrs. Sara Harris-Henderson I have a RegExp to do English letters, but not the extended set... Manuel González Försök Bokstäver Contém Espaço-Válido (Ok, these are not really names, but you get the idea) Any ideas on this? All I want to know is if a given string contains only these types of characters. anything else would give me a FALSE. Thanks Walter


« previous php.general (#172744) next »