[backstage] PHP Code for weather conditions

2006-11-01 Thread John Wards
Right heres a little snippet of code to play with the description from the weather feeds. $description = The forecast for Hartlepool, United Kingdom on Wednesday: sunny intervals. Max Temp: 8°C (46°F), Min Temp: -2°C (28°F), Wind Direction: NW, Wind Speed: 17mph, Visibility: good,

Re: [backstage] PHP Code for weather conditions

2006-11-01 Thread Matthew Somerville
John Wards wrote: preg_match(|(The forecast for (.*), (.*) on .*): (.*)\. (.*)|,$description,$match); I'd make the .*s .*?s (or add a U), just in case it ever had a new entry added along the lines of Last checked by: Mr. Jones preg_match_all(| (.*):

Re: [backstage] PHP Code for weather conditions

2006-11-01 Thread John Wards
Quoting Matthew Somerville [EMAIL PROTECTED]: preg_match_all(| (.*): (.*),|U,$match[5].,,$matches,PREG_SET_ORDER); This doesn't catch Sunset, due to you forcing that comma. Try: '| (.*): (.*)(,|\.|$)|U' (I can't remember if I put the full stop in there just in case, or if I had an

Re: [backstage] PHP Code for weather conditions

2006-11-01 Thread Matthew Somerville
John Wards wrote: Ah it does though as I add a , to the end of the subject which catches the sunset. Duh, of course, sorry. Hopefully my other suggestion still stands. :) -- ATB, Matthew | http://www.dracos.co.uk/ - Sent via the backstage.bbc.co.uk discussion group. To unsubscribe, please

Re: [backstage] PHP Code for weather conditions

2006-11-01 Thread Andrew Disley
On 1 Nov 2006, at 20:35, Laurence Samuels wrote: This sharing of code is all well and good. I support it. But sending codes along on this email address may obscure some other messages that are not about code. Isnt it possible to have a central place where codes could be put and a forum