How do I get “Lrumipsm1” from “Lörum ipsäm 1!”?
So what I need is to only get a-z and 0-9 from a string, using php.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
E.g. by using a regular expression (pcre) and replacing all characters that are not within the class of “acceptable” characters by ”.
see also: http://docs.php.net/preg_replace
edit:
[a-z0-9]is the class of all characters a….z and 0…9[^...]negates a class, i.e.[^a-z0-9]contains all characters that are not within a…z0…9+ is a quantifier with the meaning “1 or more times”,
[^a-z0-9]+matches one or more (consecutive) characters that are not within a…z0..9.The option
imakes the pattern case-insensitive, i.e. [a-z] also matches A…Z