davefootball123 Posted April 9, 2013 Share Posted April 9, 2013 I have a statement if (preg_match('/RAINFALL WARNING FOR:[\s\w\-\=NEW=\'\.]+CALEDON/', $svs)) { to match a Rainfall Warning for the town of Caledon...however it is saying there is a match for the text below...this is because CALEDONIA has the same first 7 letters as CALEDON...how would I stop this from matching.... Thanks for your help. Dave 697 WWCN11 CWTO 091842 SEVERE WEATHER BULLETIN ISSUED BY ENVIRONMENT CANADA AT 2:42 PM EDT TUESDAY 9 APRIL 2013. --------------------------------------------------------------------- WATCHES/WARNINGS IN EFFECT FOR SOUTHERN ONTARIO... RAINFALL WARNING FOR: =NEW= WINDSOR - ESSEX - CHATHAM-KENT =NEW= SARNIA - LAMBTON =NEW= ELGIN =NEW= LONDON - MIDDLESEX =NEW= SIMCOE - DELHI - NORFOLK =NEW= DUNNVILLE - CALEDONIA - HALDIMAND =NEW= OXFORD - BRANT. HEAVY RAINFALL INTO THURSDAY. --------------------------------------------------------------------- ==DISCUSSION== A SERIES OF LOW PRESSURE SYSTEMS WILL GIVE PERIODS OF RAIN TO THE REGIONS FROM THIS EVENING THROUGH WEDNESDAY AND INTO THURSDAY. THE RAIN WILL BE HEAVY AT TIMES WITH ISOLATED THUNDERSTORMS ALSO EXPECTED. RAINFALL AMOUNTS OF 50 TO 80 MM ARE EXPECTED BY THURSDAY. THE RAIN WILL LIKELY CHANGE TO FREEZING RAIN THURSDAY IN THE LONDON AND OXFORD AREAS. TO THE SOUTH, NEAR LAKE ERIE, ADDITIONAL RAINFALL AMOUNTS ARE EXPECTED BEFORE THE RAIN CHANGES TO SOME SNOW FRIDAY. REFER TO YOUR LOCAL PUBLIC FORECAST FOR FURTHER DETAILS. END/OSPC Quote Link to comment Share on other sites More sharing options...
davefootball123 Posted April 9, 2013 Author Share Posted April 9, 2013 The preg_match statement is matching each character...I guess what I need is for it to match the full piece of text or else its not a match. Any Ideas on how to do this would greatly appreciated! Thanks, Dave Quote Link to comment Share on other sites More sharing options...
davefootball123 Posted April 9, 2013 Author Share Posted April 9, 2013 fixed it with if (preg_match('/\bRAINFALL WARNING FOR:+[=NEW=\w\s\'\-]+('.$region.')\b/', $svs)) { Sorry about the post... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.