Forum: Ruby Problem with regex using mx flags

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Dan K. (Guest)
on 2005-12-22 01:06
(Received via mailing list)
Could you please take a look at this regex (line 52) that's just
killing me. (It's at <> 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
          <![CDATA[<h3>San Francisco Intl,
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.</td></tr><tr><td>CG</td><td>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
100LL, A)</td></tr><tr><td>LGT</td><td>Rwy 19L SALSF are only 1100'
long with only one flasher on the last lgt
stn.</td></tr><tr><td>MISC</td><td>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</td></tr><tr><td>MISC</td><td>rwy 0900-1400Z++, wx and cond perms.
Flt Notification Svc, ADCUS, avbl.
LLWAS.</td></tr><tr><td>NS&nbsp;ABTMT</td><td>For pro fone
C650-821-5100, 1600-0100Z++ Mon-Fri.</td></tr><tr><td>RSTD</td><td>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.</td></tr><tr><td>TFC&nbsp;PAT</td><td>Rgt tfc Rwy 10R,
          <![CDATA[San Francisco Intl (SFO)]]>
          <![CDATA[<h3>Kahului, Usa Maui
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</td></tr><tr><td>CAUTION</td><td>ter trml S
of Twy F and copter trml E of apch end Rwy 02. 130' crane 6000' SW apch
end Rwy 02.</td></tr><tr><td>FUEL</td><td>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).</td></tr><tr><td>LGT</td><td>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.</td></tr><tr><td>MISC</td><td>Crash and fire eqpt
avbl 24 hr. All rwy grooved. LLWAS 0000-0900Z. LAWRS
1600-0900Z.</td></tr><tr><td>NS&nbsp;ABTMT</td><td>See ARR/DEP GRAPHICS
Sec E.</td></tr><tr><td>RSTD</td><td>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</td></tr><tr><td>RSTD</td><td>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</td></tr><tr><td>RSTD</td><td>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.</td></tr></table>]]>
          <![CDATA[Kahului (OGG)]]>

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

  s.match(  /<longitude>(.*?)<\/longitude>.*?
    ) { |match|
      p "match: " + $1 + ":" + $2 + ":" + $3

Dan K. (Guest)
on 2005-12-25 17:15
(Received via mailing list)
Sorry, that was silly.  I was using m.match when I needed s.scan.
This topic is locked and can not be replied to.