How can I do this in javascript?
$name = $xml->name;
$file_name = strtolower($name);
$file_name = str_replace(array('-',' ',' ','å','ä','ö'), array('',' ','-','a','a','o'), $file_name);
$file_name = preg_replace("/[^a-z0-9-]+/i", "", $file_name);
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.
Mozilla has an amazing reference readily available to you. I’ve included some link in my response below.
Have a look at toLocaleLowerCase for lower casing your string. Then move on to replace which is really in many ways very similar to
preg_replacein that it is primarily based on regular expressions.Lots of reading, but it shouldn’t be too hard! Good luck!