# Problem with regex using mx flags

**URL:** <https://www.ruby-forum.com/t/problem-with-regex-using-mx-flags/50863>\
**Category:** Ruby\
**Created:** [December 22, 2005, 12:06am UTC](https://www.ruby-forum.com/t/problem-with-regex-using-mx-flags/50863 "2005-12-22T00:06:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dankitania](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e9a140/32.png) [@dankitania](https://www.ruby-forum.com/u/dankitania)\
**Post date:** [December 22, 2005, 12:06am UTC](https://www.ruby-forum.com/t/problem-with-regex-using-mx-flags/50863/1 "2005-12-22T00:06:11Z")

</div>

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](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&nbsp;19L/01R: | 193.0°/13.0°&nbsp;&nbsp;8648ft.,&nbsp;Alt.&nbsp;10.0ft. |
| Rwy&nbsp;19R/01L: | 193.0°/13.0°&nbsp;&nbsp;7500ft.,&nbsp;Alt.&nbsp;8.8ft. |
| Rwy&nbsp;28L/10R: | 283.0°/103.0°&nbsp;10602ft.,&nbsp;Alt.&nbsp;12.7ft. |
| Rwy&nbsp;28R/10L: | 283.0°/103.0°&nbsp;11870ft.,&nbsp;Alt.&nbsp;13.1ft. |
| Timezone: | UTC-8(-7DT) |
| DAFIF&nbsp;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&nbsp;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&nbsp;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&nbsp;20/02: | 205.0°/25.0°&nbsp;&nbsp;6995ft.,&nbsp;Alt.&nbsp;12.4ft. |
| Rwy&nbsp;23/05: | 235.0°/55.0°&nbsp;&nbsp;4990ft.,&nbsp;Alt.&nbsp;15.9ft. |
| Island/Group: | Maui I |
| Timezone: | UTC-10 |
| DAFIF&nbsp;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&nbsp;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  
}

}

---

<div class="post-metadata">

**Author:** ![dankitania](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e9a140/32.png) [@dankitania](https://www.ruby-forum.com/u/dankitania)\
**Post date:** [December 25, 2005, 4:15pm UTC](https://www.ruby-forum.com/t/problem-with-regex-using-mx-flags/50863/2 "2005-12-25T16:15:28Z")

</div>

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