Re: Regex - how to match until something
- From: "Rik" <luiheidsgoeroe@xxxxxxxxxxx>
- Date: Sun, 30 Apr 2006 02:55:54 +0200
veg_all@xxxxxxxxx wrote:
$string1 = preg_replace ( '/Hello.*(?!today)/', 'Hello ***' , $string1
$string1 = 'Hello world today';
'Hello world today' isn't followed by "today", so it returns true,
Read up on regexes.
Learn what (.*?) means.
$string1 = preg_replace ( '/Hello(.*?)( today)/', 'Hello ***\2' , $string1);
Grtz,
--
Rik Wasmus
.
- Follow-Ups:
- Re: Regex - how to match until something
- From: Mladen Gogala
- Re: Regex - how to match until something
- References:
- Regex - how to match until something
- From: veg_all
- Regex - how to match until something
- Prev by Date: Re: hitting the limits
- Next by Date: Re: hitting the limits
- Previous by thread: Regex - how to match until something
- Next by thread: Re: Regex - how to match until something
- Index(es):