techusky Posted October 3, 2010 Share Posted October 3, 2010 I'm normally fairly proficient with PHP, but I haven't done any coding in quite a while, so I'm a little rusty. I have an entire page of text from which I need to extract a single value. Here is a small portion of the page in question: Total Rank: 128 Total Points: 4,978 Next Rank: 20 For instance, I need to extract the values "128" "4978" and "20" and store them in variables. These values change all the time, so I'm not sure what the best way to go about this is... maybe a regular expression ? If that's the case, I've never been too good with them, so any help would be appreciated. Quote Link to comment Share on other sites More sharing options...
litebearer Posted October 3, 2010 Share Posted October 3, 2010 is each value on a new line? does the colon always precede each value? some more detail on the setup of the text page would help Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted October 3, 2010 Share Posted October 3, 2010 can you show us the code that loads the page of text and the point in the code where you need help? Quote Link to comment Share on other sites More sharing options...
techusky Posted October 3, 2010 Author Share Posted October 3, 2010 UPDATE: I accidentally included the wrong lines in my first post. The values I am trying to obtain do not have the colon next to them as I previously alluded to. Sorry for the confusion. The actual values I am trying to obtain are listed below: "1,799,447" "2,505,648,676" and "570,552,255". These three values correspond to "Points Earned" "EXP Donated" and "Credits Given", respectively. I do not have access to the code that generates the text I am trying to sift through. What I'm doing is copying all the text on the page, dumping it into my own PHP script through a form and parsing through it. Here is the full text: Steve™ Points Earned 1,799,447 EXP Donated 2,505,648,676 Credits Given 570,552,255 Repair Points Donated 13,163 Posts Made 13,145 Members Recruited 306 Item Flow Item Amount Donated Given From Guild Net Change Byte 171 9 162 Mana 0 10,000 -10,000 Ruby Herb 0 5,000 -5,000 Syn 0 1,333 -1,333 Taistelu 900 800 100 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.