in reply to Need soom regex expertise
if u wish u can try this following
$str='MAX SUSTAINED WINDS 65 KT WITH GUSTS TO 80 KT. 64 KT....... 25NE 0SE 0SW 25NW. 64 KT....... 25NE 0SE 0SW 25NW. REPEAT...CENTER LOCATED NEAR 17.0N 77.5W AT 11/2100Z MAX SUSTAINED WINDS 65 KT WITH GUSTS TO 80 KT. 64 KT....... 25NE 0S 0SW 25NW. 50 KT....... 40NE 0SE 0SW 40W. 34 KT.......100NE 75SE 0SW 75NW. 12 FT SEAS..175NE 100SE 50SW 175NW. REPEAT...CENTER LOCATED NEAR 17.0N 77.5W AT 11/2100Z'; my @text=split(/\n/,$str); my @find=(); for (@text) { if ($_ =~ m#((\d+[SNEW]{1,2} ){3}\d+[SNEW]{1,2})#gsi) { push(@find,$1); } } print "$_\n" for @find ;
output:
*************
25NE 0SE 0SW 25NW
25NE 0SE 0SW 25NW
25NE 0S 0SW 25NW
40NE 0SE 0SW 40W
100NE 75SE 0SW 75NW
175NE 100SE 50SW 175NW
Regards,
senthil kumar.k
|
|---|