---
title: "Plocka ut text ur en stor text"
type: "forum-thread"
url: "https://www.webforum.nu/amne/php/15031-plocka-ut-text-ur-en-stor-text"
topic: "PHP"
topic_url: "https://www.webforum.nu/amne/php"
author: "Asterix"
published: "2000-12-18T17:54:00.000Z"
updated: "2000-12-19T17:17:00.000Z"
replies: 2
views: 138
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/15031-plocka-ut-text-ur-en-stor-text"
---

# Plocka ut text ur en stor text

## #1 — Asterix, 2000-12-18T17:54Z

Hur gör jag för att plocka ut mindre bitar av en text ur en större. Jag vill plocka ut många textbitar ur en text och alla börjar med t.ex. BÖRJA och slutar med t.ex. SLUTA. Jag har testat med:

```
eregi("BÖRJA(.*)SLUTA", $line, $out))
```

Då tar den allt mellan den första BÖRJA och sista SLUTA och det vill jag ju inte.

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

## #2 — Ryzzen, 2000-12-19T13:19Z

```
$dataneed = "[";
$datastopp = "]";
$offset = 0;
for($i = 0; $i<10; $i++)
{
$offset = strpos($text,$dataneed,$offset);
$offset_stopp = strpos($text,$datastopp,$offset);
$data = substr($text,$offset+1,$offset_stopp-($offset+1));
$offset = $offset_stopp;
echo $data;
}//for
```

plus ett ovan för att jag vill inte har med "\["..

$data inhåller det du vill ha

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

## #3 — Asterix, 2000-12-19T17:17Z

Jag löste det i skolan, men jag hann skriva något meddelande om det men tack ändå.

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

---

Tråden på webben: https://www.webforum.nu/amne/php/15031-plocka-ut-text-ur-en-stor-text
