
May 3rd, 2002, 08:44 PM
|
|
|
|
Join Date: Apr 2007
Location: Mobile.Alabama
Posts: 32
Time spent in forums: < 1 sec
Reputation Power: 2
|
|
|
How do I only return the first of a ereg() match?
I've used this to find matching expressions, it works great if the expression is only written once. How do I only get the first and not all matches?
php Code:
Original
- php Code |
|
|
|
<? // Regular Expressions $indentify = "(HURRICANE*|TROPICAL STORM*)"; //Retrieved file $file= file("http://www.nhc.noaa.gov/archive/dis/NAL1098.012"); $fileTwo= file("http://www.nhc.noaa.gov/archive/dis/NAL1098.001"); //Loop Statement: Break into a '$lines' Array for($i=0;$i<count($fileTwo);$i++){ for($y=0;$y<count($lines);$y++){ if (ereg($indentify, $lines[$y], $defNames)) echo "$defNames[0]"; } //echo "<br>"; } ?>
|