Problem with regex using mx flags


#1

Could you please take a look at this regex (line 52) that’s just
killing me. (It’s at http://rafb.net/paste/results/l4U66N90.html or
below). When I split it up (lines 44-49) it works fine. There must be
something obvious but I can’t see it.

doc = <<EOF


KSFO

-122.374889,37.618972


-122.374889
37.618972
100000.0

#iata

<![CDATA[

San Francisco Intl, Usa

ICAO: KSFO
IATA: SFO
Altitude: 13 ft.
Type: Civil
Rwy 19L/01R: 193.0°/13.0°  8648ft., Alt. 10.0ft.
Rwy 19R/01L: 193.0°/13.0°  7500ft., Alt. 8.8ft.
Rwy 28L/10R: 283.0°/103.0° 10602ft., Alt. 12.7ft.
Rwy 28R/10L: 283.0°/103.0° 11870ft., Alt. 13.1ft.
Timezone: UTC-8(-7DT)
DAFIF Cycle: 200510
CAUTION WIP UFN apch end Rwy 28L/R and 19L. Bird haz. Rubber accumulated first 3000' Rwy28L and 28R. Pilots shall strictly flw nose-gear lines, no oversteering adjustment perms. Several rwy hold posn signs on rgt side of twy.
CG Min 24 hr PPR exc CG msn, C650-808-2901/2902 dur nml duty hr 1600-2400Z++. Svc ltd to prk, ramp space only, C-12/C-20 or smaller. No fuel, messing, space A svc,govt sfc transportation, tran qtrs, maint. 15 min before arr ctc SAN FRAN AIR 3
CG 81.8.
FUEL (NC-100, 100LL, A)
LGT Rwy 19L SALSF are only 1100' long with only one flasher on the last lgt stn.
MISC Rwy 01R-19L, 10R-28L, 10L-28R grooved exc at rwy int. Rwy 01L-19R grooved exc atrwy int and 535' N of Twy C. Hi speed Twy T grooved btn Rwy 28R and 28L. Copterldg area mrk on Twy C in front of Coast Guard OPS for mil use only. Rwy 10 pref
MISC rwy 0900-1400Z++, wx and cond perms. Flt Notification Svc, ADCUS, avbl. LLWAS.
NS ABTMT For pro fone C650-821-5100, 1600-0100Z++ Mon-Fri.
RSTD Taxi speed less than 10 Kt per hr on non-rstd twy trml side of rwy int, less than 5 Kt per hr when B747-400 pass on Twy A or B.
TFC PAT Rgt tfc Rwy 10R, 28R.
]]>







PHOG

-156.430458,20.898650


-156.430458
20.898650
100000.0

#iata

<![CDATA[

Kahului, Usa Maui Isl.

ICAO: PHOG
IATA: OGG
Altitude: 54 ft.
Type: Civil
Rwy 20/02: 205.0°/25.0°  6995ft., Alt. 12.4ft.
Rwy 23/05: 235.0°/55.0°  4990ft., Alt. 15.9ft.
Island/Group: Maui I
Timezone: UTC-10
DAFIF Cycle: 200505
CAUTION Lgtd twr 570' hi 3 NM W of arpt. Bird haz. Due to non-vis twr unable to determine if the flw areas are clear of obst/tfc; portion of Twy F btn commuter trml andapch end Rwy 05. Due to non-vis twr unable to provide svc btn acft/veh on commu
CAUTION ter trml S of Twy F and copter trml E of apch end Rwy 02. 130' crane 6000' SW apch end Rwy 02.
FUEL A+ (Air Service Hawaii, 1700-0400Z, C808-871-5572; OT 1.5 hr PN rqr, C808-870-8007 C808-757-0321, $100 fee.) (NC-100-Avbl 24 hr self-svc).
LGT When twr is unattended, ACTIVATE-MALSR Rwy 02, HIRL Rwy 02-20 and MIRL Rwy 05-23-CTAF. VASI Rwy 02 TCH 65', Rwy 20 TCH 76', Rwy 05 TCH 40'. VASI Rwy 05 unuse byd 4 NM due rising terrain.
MISC Crash and fire eqpt avbl 24 hr. All rwy grooved. LLWAS 0000-0900Z. LAWRS 1600-0900Z.
NS ABTMT See ARR/DEP GRAPHICS Sec E.
RSTD 24 hr PPR for Class A and B explosives and 4 hr PPR for other haz cargo in/out of arpt, fone C808-872-3830 1745-0230Z, OT C808-872-3888. Portions of commuter and scenic flt opr not vis fr twr. Commuter trml ramp rstd to acft 140,000 lb or l
RSTD ess. Mil copter opr rstd to haz material area N Rwy 05-23. Area E of apch end Rwy 02 designated as copter opr area. No F/W acft may opr on helipad. PPR for F/W opr on helipad C808-872-3880 1515-0800Z. Access to helipad fr Twy C only. Ramp a
RSTD rea E side of Rwy 02 under state auth. FAA not responsible for drct and ctl of gnd tfc in area. Tran prk lctd on NE sec of E ramp.
]]>





EOF

doc.scan(/(.?)</Placemark>/m) { |e|
s = e.to_s
s =~ /(.
?)</longitude>/m
long = $1
s =~ /(.?)</latitude>/m
lat = $1
s =~ /IATA:.
?([A-Z0-9]{3})[^A-Z0-9]/m
code = $1
p "line: " + long + “:” + lat + “:” + code

s.match( /(.?)</longitude>.?
(.?)</latitude>.?
IATA:.*?([A-Z0-9]{3})[^A-Z0-9]/mx
) { |match|
p "match: " + $1 + “:” + $2 + “:” + $3
}

}


#2

Sorry, that was silly. I was using m.match when I needed s.scan.