RE: [PHP] newbie question about preg_match

2004-05-20 Thread Chris W. Parker
Al on Thursday, May 20, 2004 12:51 PM said: > If I have multiple instances that match the pattern, but only want the > first one, which is the best way to handle it? reread the last sentence in John's post. > John W. Holmes wrote: > >> From: "Al" <[EMAIL PROTECTED

Re: [PHP] newbie question about preg_match

2004-05-20 Thread Al
If I have multiple instances that match the pattern, but only want the first one, which is the best way to handle it? Putting the "U" flag seems to work, but I don't understand the full implications of using it here. preg_match("|$start(.*?)$end |Ui", $contents, $text); Alternatively, I could

Re: [PHP] newbie question about preg_match

2004-05-20 Thread John W. Holmes
From: "Al" <[EMAIL PROTECTED]> > I'm trying to compose a general purpose text snip expression to extract > a text segment from a string. > > Should this work for all reasonable cases? It seems to work for several > test strings. > > $start= "str1"; > > $end= "str2"; > > preg_match ("|$start (.*)

[PHP] newbie question about preg_match

2004-05-20 Thread Al
I'm trying to compose a general purpose text snip expression to extract a text segment from a string. Should this work for all reasonable cases? It seems to work for several test strings. $start= "str1"; $end= "str2"; preg_match ("|$start (.*) ? $end |i", $contents, $text); $segment= $text