---
title: "pereg_match() hjälp"
type: "forum-thread"
url: "https://www.webforum.nu/amne/php/43834-pereg-match-hjälp"
topic: "PHP"
topic_url: "https://www.webforum.nu/amne/php"
author: "Lfe"
published: "2002-05-15T17:28:03.000Z"
updated: "2002-05-15T18:00:33.000Z"
replies: 1
views: 189
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/43834-pereg-match-hjälp"
---

# pereg_match() hjälp

## #1 — Lfe, 2002-05-15T17:28Z

jag skulle vilja hämta ut en sträng från följande exempel:

134:14 test: 0 test test hej hopp (127.0.0.1:21)

syntaxen blir alltså något i stil med:
\<digit(s)\>:\<digit(s)\>\<space\>test:\<space\>\<digit(s)\>\<space\>\<text (including spaces)\>\<space\>(\<ip:port\>)

jag vill få ut \<text (including spaces)\> i en sträng genom att använda pereg_match();

det enda jag kan tänka mig att matcha är: 
:\<space\>\<digit(s)\>\<space\>\<text (including spaces)\>\<space\>(

är dock riktigt dålig på php's perl regexp och skulle uppskatta lite hjälp..

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

## #2 — Lfe, 2002-05-15T18:00Z

löste det själv,

för er som är intresserade så ser svaret ut såhär

$temp = preg_match("#:\\s\\w+\\s(.+)\\s#", $string, $temp2);
echo $temp2\[1\];

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

---

Tråden på webben: https://www.webforum.nu/amne/php/43834-pereg-match-hjälp
