---
title: "preg_match_all problem"
type: "forum-thread"
url: "https://www.webforum.nu/amne/php/128654-preg-match-all-problem"
topic: "PHP"
topic_url: "https://www.webforum.nu/amne/php"
author: "mikaeled"
published: "2005-05-21T14:27:12.000Z"
updated: "2005-05-21T14:32:41.000Z"
replies: 1
views: 267
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/128654-preg-match-all-problem"
---

# preg_match_all problem

## #1 — mikaeled, 2005-05-21T14:27Z

```php
$str = "(advertiser $0.30)(advertiser $3.20)(advertiser $1.66)";

preg_match_all('/\(advertiser (.*?)\)/', $str, $matches);
$numbers = $matches[1];
```

Det ovan fungerar klanderfritt, frågan är hur man gör för reg expression om man vill dela 

```php
$str = "<td align="center" class="t">DATA_SOM_SKA_PLOCKAS1</td>
<td align="center" class="t">DATA_SOM_SKA_PLOCKAS2</td>
<td align="center" class="t">DATA_SOM_SKA_PLOCKAS3</td>";
```

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

## #2 — Matte, 2005-05-21T14:32Z

Testa med

```
preg_match_all("/<td[^>]+>(.*?)<\/td>/is", $str, $matches);
```

 
Då har du dina träffar i arrayen $matches\[1\].

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

---

Tråden på webben: https://www.webforum.nu/amne/php/128654-preg-match-all-problem
