0

I have these regular expression to grab the Oscars, wins, and nomination from a person (for example Cote de Pablo).

preg_match('/([0-9]+) Oscars/', $url, $oscars);
preg_match('/([0-9]+) ([win|wins]+)/', $url, $wins);
preg_match('/([0-9]+) nominations/', $url, $nominations);

There is more awards than these three though and I wonder how I can grab all of the awards for a person and for a movie or TV serie with two separated regular expression?

Thanks in advance.

Airikr
  • 6,258
  • 15
  • 59
  • 110
  • 3
    Please refrain from parsing HTML with RegEx as it will [drive you į̷̷͚̤̤̖̱̦͍͗̒̈̅̄̎n̨͖͓̹͍͎͔͈̝̲͐ͪ͛̃̄͛ṣ̷̵̞̦ͤ̅̉̋ͪ͑͛ͥ͜a̷̘͖̮͔͎͛̇̏̒͆̆͘n͇͔̤̼͙̩͖̭ͤ͋̉͌͟eͥ͒͆ͧͨ̽͞҉̹͍̳̻͢](http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454). Use an [HTML parser](http://stackoverflow.com/questions/292926/robust-mature-html-parser-for-php) instead. – Madara's Ghost Jul 27 '12 at 23:40
  • Regular expression may cause some (read: a lot!!) frustrations during the programming, yes :P I will try that you have suggested but I want also know how the regular expression will looks like for my "little" problem. – Airikr Jul 27 '12 at 23:44
  • 2
    Parse the HTML from the awards page (e.g. http://www.imdb.com/name/nm0000129/awards), which appears to be in tables, rather than use regex, which is certainly going to be more headache than it's worth. It should also be noted that technically, IMDB [does not allow screen scraping](http://www.imdb.com/help/show_article?conditions) – ernie Jul 27 '12 at 23:47
  • @ernie It is very true about the screen scraping. I can't remember what the name of the other IMDb similar website (...MDB something) is so I'm using IMDb's for now. – Airikr Jul 27 '12 at 23:51

1 Answers1

1

Honestly you can just copy/paste it, however if you want it to consistently update it thats a different story.