2

I'm trying to fetch a persons body height from IMDb but the line for it contains a # which indicate a comment in PHP (for example # The comment as follows). Here is how it looks like from IMDb's source code:

<h4 class="inline">Height:</h4>
5' 7&#34; (1.70 m)

Here is my attempted regular expression:

<h4 class="inline">Height:</h4>\n([0-9' &#;(.)m]+)

What should I do to prevent it to comment the rest of the regular expression after the # character?

Thanks in advance!

EDIT

Here is the result from adding \ to the regular expression: enter image description here

ChrisW
  • 4,970
  • 7
  • 55
  • 92
Airikr
  • 6,258
  • 15
  • 59
  • 110
  • 1
    [Take advice from here.](http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags) – VolatileRig Jul 26 '12 at 23:08
  • 3
    Don't use RegEx. http://simplehtmldom.sourceforge.net/ OR http://php.net/manual/en/book.dom.php – Paul Dessert Jul 26 '12 at 23:08
  • Paul: I want to use regular expression. Radix: Please see my image in my edited question. `\` didn't solve it :/ – Airikr Jul 26 '12 at 23:13

1 Answers1

2

I have solved my problem and here is the answer:

/<h4 class="inline">Height:<\/h4>\n([0-9\' ]+)&#34; ([0-9. m()]+)/

Airikr
  • 6,258
  • 15
  • 59
  • 110
  • 1
    drats! beat me by about a minute -- had it up on board. Congratulations a plus 1 for self sufficiency! – Radix Jul 26 '12 at 23:27