Author Topic: "Everything in Between"  (Read 398 times)

0 Members and 1 Guest are viewing this topic.

Offline markvaughn2006Topic starter

  • Enthusiast
  • Posts: 105
    • View Profile
"Everything in Between"
« on: March 24, 2010, 02:00:00 PM »
Hello, i know this is probably pretty simple but still very new to regex stuff... how would i go about retreiving - 0.008025
from this

<span class="sg">
<span id="ref_73025_l">0.008025</span>

so actually i would need to get everything in between '<span class="sg"><span id="ref_*">' and '</span>'
the 73025_1 would be changing (sometimes 4,5,or 6 characters long)so I would need to wildcard that part somehow...

and capturing the result in a variable? thanks!!!!!!!! :D :D :D :D
« Last Edit: March 24, 2010, 02:10:45 PM by markvaughn2006 »

Offline premiso

  • Karma Chameleon
  • Staff Alumni
  • Freak!
  • *
  • Posts: 6,670
  • Gender: Female
  • effing right
    • View Profile
    • PHP Help
Re: "Everything in Between"
« Reply #1 on: March 24, 2010, 02:10:36 PM »
preg_match('~<span id="ref_.*">(.*)</span>~isU'$string$matches);

Should get you want you want. Result will be in $matches[1].

Offline markvaughn2006Topic starter

  • Enthusiast
  • Posts: 105
    • View Profile
Re: "Everything in Between"
« Reply #2 on: March 24, 2010, 02:18:39 PM »
you are fricking awesome, thanks!!!!!  :o