Regex Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreRegex Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 5th, 2011, 05:04 PM
rascle rascle is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2011
Posts: 1 rascle User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 34 m 2 sec
Reputation Power: 0
Preg_match help

Hi,
I dont know if this should be posted here or on the php page but Basically I am trying to use the code below:
Code:
<?php $eurovalue = file_get_contents("dump.txt"); $eurovalue = htmlspecialchars($eurovalue); $pattern = '/<td><a.*>USD\/EUR<\/a><\/td>.*<td\s*\w*>\s*<img\s*[\w\d]*\s*\/>(\d+)<\/td>/si'; preg_match($pattern,$eurovalue,$euroarray); $euroresult = $euroarray[0]; echo $euroresult; ?>

To find this code:
Code:
<td><a href="/business/currencies/quote?srcAmt=1&srcCurr=USD&destAmt=&destCurr=EUR">USD/EUR</a></td> <td class="data changeUp"> <img width="9" height="10" src="/resources_v2/images/changeUp.gif" />0.69070</td>


In a script that contains similar <td>'s, also the 0.69070 is subject to change. The preg_match that I am using isnt working and I cant work out why. I imagine it is something to do with the regex. The code that it is searching for is located in dump.text and this is all working fine, it just seems to be the preg_match.
Any help would be appreciated,
Thanks
Rhys

Reply With Quote
  #2  
Old July 5th, 2011, 08:41 PM
requinix's Avatar
requinix requinix is offline
Still alive
Click here for more information.
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,681 requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 4 Days 2 h 20 m 36 sec
Reputation Power: 8969
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix Send a message via Google Talk to requinix
I haven't looked at the regex, but try without using htmlspecialchars().

Reply With Quote
  #3  
Old July 6th, 2011, 10:22 AM
rasclerhys rasclerhys is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2011
Posts: 1 rasclerhys User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 10 sec
Reputation Power: 0
Hi (I had to change my account as my previous one didnt work)
I tried removing the htmlspecialchars but it still didnt work. I think it is needed as the Regex searches for the html to identify the value, so without the htmlspecialchars it cant do this.
Any other ideas?
Thanks
Rhys

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreRegex Programming > Preg_match help

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap