ainoy31 Posted June 23, 2011 Share Posted June 23, 2011 I have been over this piece of code for a couple of hours and cannot determine why it does not find a match. I appreciate a second eye on this. Data: XVZ020-932300- Test Me VALLEY- INCLUDING...York Town...NORTH York Town...HENDERSON... BOULDER CITY 310 AM PDT THU JUN 29 2011 .DATA...TEST. HIGHS AROUND 101 ON THE WEST SIDE OF THE VALLEY... AROUND 111 ON THE EAST SIDE. SOUTHWEST WIND 10 TO 20 MPH. GUSTS UP TO 20 MPH INCREASING TO 30 MPH IN THE AFTERNOON. .DATA...CLEAR...BREEZY. LOWS AROUND 79 ON THE WEST SIDE OF THE VALLEY...AROUND 80 ON THE EAST SIDE. SOUTHWEST WIND 15 TO 25 MPH DECREASING TO 10 TO 15 MPH AFTER MIDNIGHT. $$ Script: if(preg_match_all("/\n[A-Z]{2}[ZC][0-9]{3}[A-Za-z0-9\-\=\+\,\ \.\/\[\]\(\)\:\;\'\"\&\@\#\%\!\,\>\<\n]*?\n\\$\\$/", $data, $match)) { print_r($match); } else { echo "No Match"; } Much appreciation. Quote Link to comment Share on other sites More sharing options...
fugix Posted June 23, 2011 Share Posted June 23, 2011 I don't think that you fully understand how regexp works. That code will never grab anything. Are you trying to grab that entire snippet or a piece of it? Quote Link to comment Share on other sites More sharing options...
ainoy31 Posted June 23, 2011 Author Share Posted June 23, 2011 fugix, Do me a favor and don't claim you know me fully. If you don't have something useful to say, just be quiet in the corner of the room. Quote Link to comment Share on other sites More sharing options...
fugix Posted June 23, 2011 Share Posted June 23, 2011 Never claimed I knew you. But judging from your code my first statement stands. My question was to understand further. But if you dobtcwsbt my help...oh well Quote Link to comment Share on other sites More sharing options...
ainoy31 Posted June 23, 2011 Author Share Posted June 23, 2011 The word Data: is not part of what I can matching against. If that is throwing you off then, my verbage was wrong. I get matching rows but some data that comes across does not match and this example is one of them Quote Link to comment Share on other sites More sharing options...
silkfire Posted June 23, 2011 Share Posted June 23, 2011 Darling the point of regex is to: 1) either check that something follows a certain determined pattern, or 2) to extract something from a larger text according to a determined pattern. What is that you want to extract or match? Explain and I will help you. 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.