Re: [PHP] Re: Regex for extracting quoted strings

2011-03-07 Thread Shawn McKenzie
On 03/05/2011 04:38 PM, Mark Kelly wrote: > Hi. > > Thanks for all the replies. > > On Saturday 05 Mar 2011 at 22:11 Simon J Welsh wrote: > >> On 6/03/2011, at 11:08 AM, Shawn McKenzie wrote: >>> $regex = '/"([^"]+)"/'; > > Shawn, this regex gets me two copies of each string - one with and one

Re: [PHP] Re: Regex for extracting quoted strings

2011-03-05 Thread Shuo
Maybe this will help. $regex = '/(?<=")[^.]*(?=")/'; $r = preg_match_all($regex, $sentence, $phrases);

Re: [PHP] Re: Regex for extracting quoted strings

2011-03-05 Thread Mark Kelly
Hi. Thanks for all the replies. On Saturday 05 Mar 2011 at 22:11 Simon J Welsh wrote: > On 6/03/2011, at 11:08 AM, Shawn McKenzie wrote: > > $regex = '/"([^"]+)"/'; Shawn, this regex gets me two copies of each string - one with and one without the double quotes - as did the one Nathan posted e

Re: [PHP] Re: Regex for extracting quoted strings

2011-03-05 Thread Simon J Welsh
On 6/03/2011, at 11:08 AM, Shawn McKenzie wrote: > On 03/05/2011 09:26 AM, Mark Kelly wrote: >> Hi. >> >> I'm hoping someone can help me extract text between double quotes from a >> string. >> >> $regex = 'some magic'; >> $r = preg_match($regex, $sentence, $phrases); >> >> So, if >> >> $sen

[PHP] Re: Regex for extracting quoted strings

2011-03-05 Thread Shawn McKenzie
On 03/05/2011 09:26 AM, Mark Kelly wrote: > Hi. > > I'm hoping someone can help me extract text between double quotes from a > string. > > $regex = 'some magic'; > $r = preg_match($regex, $sentence, $phrases); > > So, if > > $sentence = 'Dave said "This is it". "Nope, that is the wrong colour

[PHP] Re: Regex for extracting quoted strings

2011-03-05 Thread Nathan Rixham
Mark Kelly wrote: Hi. I'm hoping someone can help me extract text between double quotes from a string. $regex = 'some magic'; $r = preg_match($regex, $sentence, $phrases); So, if $sentence = 'Dave said "This is it". "Nope, that is the wrong colour" she replied.'; I want $phrases to cont