Jump to content

preg_match_all() Issue


ainoy31

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/240217-preg_match_all-issue/
Share on other sites

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.