[Linux-disciples] Perl pattern matching

Stephen R Laniel steve at laniels.org
Fri Nov 18 10:18:33 EST 2005


Any idea why this isn't working the way I think it should
work?

(10:16) slaniel at TheloniousMonk:~$ wget -O - 'http://rss.netflix.com/QueueRSS?id=P2020071624879355028177181315700043' 2>/dev/null |perl -e "while(<>) { \
  if( m{<item>}..m{</item>} ) { \
    if( m{<title>(.*?)</title>} ) { \
      print $1; \
    } \
  } \
}"

The "$1" bit should, I think, print only the bits of the RSS feed
that lie between "<title>" and "</title>", but instead I'm
getting the results below -- which include the </?title>
bits. Any idea what that's about?

      <title>1- City of God</title>
      <title>2- American Splendor</title>
      <title>3- Capturing the Friedmans</title>
      <title>4- Spellbound</title>
      <title>5- Red</title>
      <title>6- The Decalogue: Disc 1: Films I - III</title>
      <title>7- The Decalogue: Disc 2: Films IV - VII</title>
      <title>8- The Decalogue: Disc 3: Films VIII - X</title>
      <title>9- To Catch a Thief</title>
      <title>10- The Maltese Falcon</title>
      <title>11- Batman Begins</title>
      <title>12- Touching the Void</title>
      <title>13- Born Into Brothels</title>
      <title>14- Dark City</title>
      <title>15- Melinda and Melinda</title>
      <title>16- Night and Fog</title>
      <title>17- White</title>
      <title>18- The Life Aquatic with Steve Zissou</title>
      <title>19- The Virgin Suicides</title>
      <title>20- Igby Goes Down</title>
      <title>21- Bonnie and Clyde</title>
      <title>22- A Streetcar Named Desire</title>
      <title>23- Me and You and Everyone We Know</title>
      <title>24- The Philadelphia Story</title>
      <title>25- Gaslight</title>
      <title>26- The Beat That My Heart Skipped</title>
      <title>27- Ray</title>
      <title>28- Paris, Texas</title>
      <title>29- Hiroshima Mon Amour</title>
      <title>30- Nosferatu: Original Version</title>
      <title>31- The Last Picture Show</title>
      <title>32- Crumb</title>
      <title>33- Serpico</title>
      <title>34- The French Connection</title>
      <title>35- Once Upon a Time in the West</title>
      <title>36- Open City</title>
      <title>37- The Testament of Dr. Mabuse</title>
      <title>38- The Trials of Henry Kissinger</title>
      <title>39- Buena Vista Social Club</title>
      <title>40- Open Your Eyes</title>
      <title>41- In the Company of Men</title>
      <title>42- Sanjuro</title>
      <title>43- Casablanca</title>
      <title>44- The King of Comedy</title>
      <title>45- The Hustler</title>
      <title>46- The Last Waltz</title>
      <title>47- Nights of Cabiria</title>
      <title>48- His Girl Friday</title>
      <title>49- The Pawnbroker</title>
      <title>50- Fishing With John</title>

-- 
Stephen R. Laniel
steve at laniels.org
+(617) 308-5571
http://laniels.org/
PGP key: http://laniels.org/slaniel.key
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.bostoncoop.net/pipermail/linux-disciples/attachments/20051118/f3423eae/attachment.pgp


More information about the Linux-disciples mailing list