---
title: "å,ä,ö till a,a,o med preg_replace"
type: "forum-thread"
url: "https://www.webforum.nu/amne/php/136463-å-ä-ö-till-a-a-o-med-preg-replace"
topic: "PHP"
topic_url: "https://www.webforum.nu/amne/php"
author: "filipbh"
published: "2005-10-26T21:03:46.000Z"
updated: "2005-10-27T09:37:01.000Z"
replies: 2
views: 1484
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/php/136463-å-ä-ö-till-a-a-o-med-preg-replace"
---

# å,ä,ö till a,a,o med preg_replace

## #1 — filipbh, 2005-10-26T21:03Z

Hej... 

Finns det nåt enklare sätt göra om å,ä,ö än detta?

```php
$newfile = preg_replace("/[å]/i", "a", $newfile); 
$newfile = preg_replace("/[Å]/i", "A", $newfile); 
$newfile = preg_replace("/[ä]/i", "a", $newfile); 
$newfile = preg_replace("/[Ä]/i", "A", $newfile); 
$newfile = preg_replace("/[ö]/i", "o", $newfile); 
$newfile = preg_replace("/[Ö]/i", "O", $newfile);
```

T.ex. Skriver man ett stort Ö ska det inte bli "o" utan "O".

Tack på förhand

Permalänk: https://www.webforum.nu/p/136463

## #2 — emission, 2005-10-26T21:27Z

```
$newfile = preg_replace(array('/å/','/ä/','/ö/','/Å/','/Ä/','/Ö/'), array('a','a','o','A','A','O'), $newfile);
```

Om du hade problem med att "Ö" blev "o" så beror det på att du använder i-flaggan, som gör att matchningen blir case insensitive.

Permalänk: https://www.webforum.nu/p/1695552

## #3 — filipbh, 2005-10-27T09:37Z

Tack!

Permalänk: https://www.webforum.nu/p/1695680

---

Tråden på webben: https://www.webforum.nu/amne/php/136463-å-ä-ö-till-a-a-o-med-preg-replace
