[pmwiki-devel] PHP help for a recipe

Simon nzskiwi at gmail.com
Sun Jul 28 04:06:06 CDT 2013


Chuck

thanks and thanks

really appreciate your explanation, and effort to fix my regex and show me
how it works properly in preg_match_all

I'll remember you point about plain text email for code

Simon



On 26 July 2013 10:57, Chuck Goldstein <cgpmw13 at codingmaniac.com> wrote:

> Please see my solution at:
>
>  http://www.codingmaniac.com/phptest/simon01.php6
>
> Also, it's better to compose email containing code as plaintext
> only.  It looks like your email client surrounded bolded text with
> asterisks in the plaintext version.  This is especially confusing
> when it occurs within regular expressions.
>
> Chuck G
>
>
> On Fri, 19 Jul 2013 pmwiki-devel-request at pmichaud.com wrote:
>
> > Message: 2
> > Date: Wed, 17 Jul 2013 22:28:06 +1200
> > From: Simon <nzskiwi at gmail.com>
> > To: PmWiki Devel Mailing List <pmwiki-devel at pmichaud.com>
> > Subject: [pmwiki-devel] PHP help for a recipe
> > Message-ID:
> >       <
> CAFUSNWOs2HoxSSfVxJyp1PhVs8AaHn_j4kC0KTMwPbxzDHPYJw at mail.gmail.com>
> > Content-Type: text/plain; charset="utf-8"
> >
> > I'm hoping someone could help me out with a little advice,
> > I'm trying to use a regex to extract data from a list of lats and longs,
> > where lats and longs are defined using the regexs
> >   $vlat     = '*[-+]?\d{1,2}[.]\d+*'; # -90 .. 90
> >   $vlong    = '*[-+]?[1]?\d{1,2}[.]\d+*'; # -180 .. 180
> >
> > The list of coordinate pairs looks like this
> >
> >   $vlatlong = $vlat . '[,]' . $vlong; # latitude,longitude
> >   $pllbs    = 'llbs=' .* $vlatlong . '(?:[;]' . $vlatlong . ')+*'; # two
> or
> > more pairs of lat long co-ordinates
> >
> > I'd like to use subpatterns to extract the lats and longs,
> > along the lines of
> >
> >     $lngs = preg_split ('/(?:' . $vlat . '[,](' . $vlong . ')[;])+/',
> > $opt['llbs'] . ';');
> > or
> >     preg_match ('/(?:(' . $vlat . ')[,]' . $vlong . '[;])+/',
> $opt['llbs']
> > . ';', $lats);
> >
> > where $opt['llbs'] =
> > '-45.383518,168.267111;-45.374354,168.302387;-45.402745,168.254151';
> >
> > But neither of these approaches works for me.
> > I suspect its something basic around the correct usage of the language
> or a
> > function.
> > so if anyone could point me in the right direction I'd be grateful
> >
> > Simon
>
> _______________________________________________
> pmwiki-devel mailing list
> pmwiki-devel at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-devel
>



-- 
____
http://kiwiwiki.co.nz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-devel/attachments/20130728/db85e002/attachment.html>


More information about the pmwiki-devel mailing list