title: Help with regular expressions (Parsing Wikipedia Markup) in PHP
body: <p>I have this bit of text that I want to remove from a page I am fetching from Wikipedia.</p>
  
  <pre><code>{{Historical populations|type=USA
  | 1698|4937
  | 1712|5840
  | 1723|7248
  | 1737|10664
  | 1746|11717
  | 1756|13046
  | 1771|21863
  | 1790|33131
  | 1800|60515
  | 1810|96373
  | 1820|123706
  | 1830|202589
  | 1840|312710
  | 1850|515547
  | 1860|813669
  | 1870|942292
  | 1880|1206299
  | 1890|1515301
  | 1900|3437202
  | 1910|4766883
  | 1920|5620048
  | 1930|6930446
  | 1940|7454995
  | 1950|7891957
  | 1960|7781984
  | 1970|7894862
  | 1980|7071639
  | 1990|7322564
  | 2000|8008288
  | 2008*|8363710
  |footnote=Beginning 1900, figures are for consolidated city of five boroughs. Sources: 1698–1771,{{cite book|last=Greene and Harrington|first=|title=American Population Before the Federal Census of 1790|publisher=|location=New York|year=1932|isbn=|pages=}}, as cited in: {{cite book|last=Rosenwaike|first=Ira|title=Population History of New York City|publisher=Syracuse University Press|location=Syracuse, N.Y.|year=1972|isbn=0815621558|page=8}} 1790–1990,Gibson, Campbell.[http://www.census.gov/population/www/documentation/twps0027.html Population of the 100 Largest Cities and Other Urban Places in the United States:1790 to 1990], [[United States Census Bureau]], June 1998. Retrieved June 12, 2007. *2008 est[http://factfinder.census.gov/servlet/SAFFPopulation?_event=Search&amp;geo_id=16000US3403940&amp;_geoContext=01000US%7C04000US34%7C16000US3403940&amp;_street=&amp;_county=new+york+city&amp;_cityTown=new+york+city&amp;_state=04000US36&amp;_zip=&amp;_lang=en&amp;_sse=on&amp;ActiveGeoDiv=geoSelect&amp;_useEV=&amp;pctxt=fph&amp;pgsl=160&amp;_submenuId=population_0&amp;ds_name=null&amp;_ci_nbr=null&amp;qr_name=null&amp;reg=null%3Anull&amp;_keyword=&amp;_industry=Census Data for New York city, New York], [[United States Census Bureau]]. Retrieved June 12, 2007.
  }}
  </code></pre>
  
  <p>The following part I wish to keep as plain text also (but not including parts wrapped with "{{" and "}}"</p>
  
  <pre><code>New York is the most populous city in the United States, with an estimated 2008 population of 8,363,710(up from 7.3 million in 1990). This amounts to about 40.0% of New York State's population and a similar percentage of the metropolitan regional population. Over the last decade the city's population has been increasing and demographers estimate New York's population will reach between 9.2 and 9.5 million by 2030.{{cite web |title=New York City Population Projections by Age/Sex and Borough, 2000-2030 |publisher=[[New York City Department of City Planning]] |month=December | year=2006 |url=http://www.nyc.gov/html/dcp/pdf/census/projections_report.pdf |format=PDF |accessdate=2008-09-01}} See also {{cite news |last=Roberts, Sam |title=By 2025, Planners See a Million New Stories in the Crowded City |publisher=New York Times |date=February 19, 2006 |url=http://www.nytimes.com/2006/02/19/nyregion/19population.html?ex=1298005200&amp;en=c586d38abbd16541&amp;ei=5090&amp;partner=rssuserland&amp;emc=rss |accessdate=2008-09-01}}
  </code></pre>
  
  <p>Thanks.</p>