What would be the best way to pull a number with tags around it from text

Discussion in 'PHP' started by x0x, Nov 14, 2009.

  1. #1
    Let's say I have this:

    "Hello, you are <age>19</age> years old, you make $<cash>65,248</cash> a year."

    Same random text I just came up with.

    I need to pull the numbers from the text and assign them to variables.

    I figured the best way to do that would be to use preg_match and pull them somehow... Any idea how? :) It should pull them by the tags... The real thing is much more complicated, but this would really help me. Although I remember someone telling me not to use regex to parse html...
     
    Last edited: Nov 14, 2009
    x0x, Nov 14, 2009 IP